Ricardo_34100 Posted February 27, 2012 Report Share Posted February 27, 2012 eu queria saber como é que se elimina 1 elemento à nossa escolha de uma listbox? queria tambem saber como se elimina elementos à nossa escolha de uma listview e de uma treeview? Link to comment Share on other sites More sharing options...
Caça Posted February 27, 2012 Report Share Posted February 27, 2012 Podes eliminar pelo respectivo Index. Pedro Martins Não respondo a duvidas por PM Link to comment Share on other sites More sharing options...
Ricardo_34100 Posted February 27, 2012 Author Report Share Posted February 27, 2012 eu tnh assim mas dame excepçao: private void button1_Click(object sender, EventArgs e) { if (listBoxNome.SelectedIndex >= 0) { DialogResult decisao; decisao = MessageBox.Show("quer mesmo apagar?" + Environment.NewLine + label4.Text, "Apagar?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if(decisao==DialogResult.Yes) { listBoxNome.Items.RemoveAt(listBoxNome.SelectedIndex); listBoxNumero.Items.RemoveAt(listBoxNumero.SelectedIndex); } } } Link to comment Share on other sites More sharing options...
Ricardo_34100 Posted February 27, 2012 Author Report Share Posted February 27, 2012 ja resolvi , mas eu tambem kria apagar o que tnh na picturebox, isto é, quando eu apago um elemento da textbox, kro apagr o correspondente ao da picturebox Link to comment Share on other sites More sharing options...
Caça Posted February 27, 2012 Report Share Posted February 27, 2012 Tens alguma coisa para conseguires fazer essa correspondência? Pedro Martins Não respondo a duvidas por PM Link to comment Share on other sites More sharing options...
Ricardo_34100 Posted February 27, 2012 Author Report Share Posted February 27, 2012 por exemplo, ao apagar um numero(o numero 2), aparece na picturebox 2 bolas.eu queria que, ao apagar o numero 2, apagasse o numero de bolas correspondente ao um numero Link to comment Share on other sites More sharing options...
Caça Posted February 27, 2012 Report Share Posted February 27, 2012 E estás a utilizar uma PictureBox para cada bola? Como é que estás a utilizar as PictureBoxes? Pedro Martins Não respondo a duvidas por PM Link to comment Share on other sites More sharing options...
Ricardo_34100 Posted February 27, 2012 Author Report Share Posted February 27, 2012 private void buttonAdicionar_Click(object sender, EventArgs e) { FormAdicionar fAdd = new FormAdicionar(); fAdd.ShowDialog(); if (fAdd.DialogResult == DialogResult.OK) { infoAlunos.adicionar(fAdd.Aluno); listBoxNumero.Items.Add(fAdd.Aluno.Numero); listBoxNome.Items.Add(fAdd.Aluno.Nome); Graphics gdi = pictureBoxGrafico.CreateGraphics(); int j = 0; foreach (Aluno al in infoAlunos.Al) { for (int i = 0; i < al.Numero.ToString().Length; i++) { gdi.FillEllipse(Brushes.Green, 14 * i, 14 * j, 14, 14); } j++; } } } Link to comment Share on other sites More sharing options...
Caça Posted February 27, 2012 Report Share Posted February 27, 2012 Se estás a utilizar GDI, talvez seja melhor redesenhar. Pedro Martins Não respondo a duvidas por PM Link to comment Share on other sites More sharing options...
Ricardo_34100 Posted February 27, 2012 Author Report Share Posted February 27, 2012 fiz um pictureboxGrafico.refresh(); bgd Link to comment Share on other sites More sharing options...
Ricardo_34100 Posted February 27, 2012 Author Report Share Posted February 27, 2012 afinal n da Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now