예제 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            var form = new DescriptionForm(new Description());
            var res  = form.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                listBox1.Items.Add(form.des);
            }
        }
예제 #2
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            var des = listBox1.SelectedItem as Description;

            if (des == null)
            {
                return;
            }
            var form = new DescriptionForm(des.Clone());
            var res  = form.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                var si = listBox1.SelectedIndex;
                listBox1.Items.RemoveAt(si);
                listBox1.Items.Insert(si, form.des);
            }
            button4.Enabled = true;
        }