Пример #1
0
        private void EditDevice()
        {
            var selections = Cells.Selections;
            var sheet      = Cells.Sheets[0];

            if (selections.Count == 0)
            {
                MessageBox.Show("请选择要修改的项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            foreach (var selection in selections)
            {
                for (int index = -1; index < selection.RowCount; index++)
                {
                    //至少执行一次下方的代码,即使 selection.RowCount = 0 的情况下
                    if (index == -1)
                    {
                        index = 0;
                    }

                    var i = selection.Row + index;
                    if (Source.Count > i)
                    {
                        var form = new ModifyDevice(Source[i]);
                        form.Show();
                        form.FormClosed += new FormClosedEventHandler(ModifyDevice_FormClosed);
                    }
                }
            }
        }
Пример #2
0
        private void Add_Click(object sender, EventArgs e)
        {
            ModifyDevice add = new ModifyDevice();

            add.FormClosed += new FormClosedEventHandler(ModifyDevice_FormClosed);
            add.Show();
        }
Пример #3
0
        private void Edit_Click(object sender, EventArgs e)
        {
            var form = new ModifyDevice(Source);

            form.Show();

            this.Close();
        }