コード例 #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;
                }
            }
        }