private void button6_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { Form1 f = new Form1(); f.Text = "Редактировать"; Risunok m = listBox1.Items[listBox1.SelectedIndex] as Risunok; // int x1 = m.x; // f.numericUpDown1.Value = x1; // f.numericUpDown2.Value = m.y; // f.numericUpDown3.Value = m.l; // f.numericUpDown4.Value = m.s; f.pictureBox1.BackColor = m.myColor; if (f.ShowDialog() == DialogResult.OK) { timer1.Stop(); m.Stir(); int x = Convert.ToInt32(f.numericUpDown1.Value); int y = Convert.ToInt32(f.numericUpDown2.Value); int l = Convert.ToInt32(f.numericUpDown3.Value); int s = Convert.ToInt32(f.numericUpDown4.Value); Color cl = f.pictureBox1.BackColor; // x1 = x; m.y = y; m.l = l; m.s = s; m.myColor = cl; listBox1.Items[listBox1.SelectedIndex] = m; timer1.Start(); } } }
private void timer1_Tick(object sender, EventArgs e) { for (int i = 0; i < listBox1.Items.Count; i++) { Risunok m = listBox1.Items[i] as Risunok; m.Dviz(); } }
private void button5_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { Risunok m = listBox1.Items[listBox1.SelectedIndex] as Risunok; m.Stir(); listBox1.Items.RemoveAt(listBox1.SelectedIndex); } }