예제 #1
0
파일: Form1.cs 프로젝트: grismanss/IS_19
        private void Button3_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex != -1)
            {
                Form2 f = new Form2();
                f.Text = "Редактировать";
                MyCircle m = listBox1.Items[listBox1.SelectedIndex]
                             as MyCircle;
                f.numericUpDown1.Value  = m.x;
                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.Stiranie();
                    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;
                    m.x       = x;
                    m.y       = y;
                    m.l       = l;
                    m.s       = s;
                    m.myColor = cl;
                    listBox1.Items[listBox1.SelectedIndex] = m;
                    timer1.Start();
                }
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: grismanss/IS_19
        private void Button2_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex != -1)
            {
                MyCircle m = listBox1.Items[listBox1.SelectedIndex]
                             as MyCircle;
                m.Stiranie();
                listBox1.Items.RemoveAt(listBox1.SelectedIndex);
                toolStripStatusLabel1.Text = "";
                toolStripStatusLabel2.Text = "";
                toolStripStatusLabel3.Text = "";

                if (listBox1.Items.Count == 0)
                {
                    button2.Enabled = false;
                    button3.Enabled = false;
                    редактироватьToolStripMenuItem.Enabled = false;
                    удалитьToolStripMenuItem.Enabled       = false;
                    toolStripButton2.Enabled = false;
                    toolStripButton3.Enabled = false;
                }
            }
        }