Пример #1
0
        private void button_groupContents_modify_Click(object sender, EventArgs e)
        {
            if (this.listView_groupContents_lines.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选定要修改的事项");
                return;
            }

            CellLineDialog dlg = new CellLineDialog();

            MainForm.SetControlFont(dlg, this.Font, false);

            dlg.FillGroupFieldNameTable();
            dlg.FieldName     = this.listView_groupContents_lines.SelectedItems[0].Text;
            dlg.Caption       = this.listView_groupContents_lines.SelectedItems[0].SubItems[1].Text;
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            ListViewItem item = this.listView_groupContents_lines.SelectedItems[0];

            item.Text = dlg.FieldName;
            ListViewUtil.ChangeItemText(item, 1, dlg.Caption);

            this.m_bGroupContentsChanged = true;
        }
Пример #2
0
        private void button_groupContents_new_Click(object sender, EventArgs e)
        {
            CellLineDialog dlg = new CellLineDialog();

            MainForm.SetControlFont(dlg, this.Font, false);

            dlg.FillGroupFieldNameTable();
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            // 查重?
            // 名称查重
            ListViewItem dup = ListViewUtil.FindItem(this.listView_groupContents_lines, dlg.FieldName, 0);

            if (dup != null)
            {
                // 让操作者能看见已经存在的行
                ListViewUtil.SelectLine(dup, true);
                dup.EnsureVisible();

                DialogResult result = MessageBox.Show(this,
                                                      "当前已经存在名为 '" + dlg.FieldName + "' 的内容行。继续新增?",
                                                      "BindingOptionDialog",
                                                      MessageBoxButtons.YesNo,
                                                      MessageBoxIcon.Question,
                                                      MessageBoxDefaultButton.Button2);
                if (result == DialogResult.No)
                {
                    return;
                }
            }



            ListViewItem item = new ListViewItem();

            item.Text = dlg.FieldName;
            ListViewUtil.ChangeItemText(item, 1, dlg.Caption);

            this.listView_groupContents_lines.Items.Add(item);
            ListViewUtil.SelectLine(item, true);
            item.EnsureVisible();

            listView_groupContents_lines_SelectedIndexChanged(sender, null);

            this.m_bGroupContentsChanged = true;
        }
Пример #3
0
        private void button_groupContents_modify_Click(object sender, EventArgs e)
        {
            if (this.listView_groupContents_lines.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选定要修改的事项");
                return;
            }

            CellLineDialog dlg = new CellLineDialog();
            MainForm.SetControlFont(dlg, this.Font, false);

            dlg.FillGroupFieldNameTable();
            dlg.FieldName = this.listView_groupContents_lines.SelectedItems[0].Text;
            dlg.Caption = this.listView_groupContents_lines.SelectedItems[0].SubItems[1].Text;
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
                return;

            ListViewItem item = this.listView_groupContents_lines.SelectedItems[0];
            item.Text = dlg.FieldName;
            ListViewUtil.ChangeItemText(item, 1, dlg.Caption);

            this.m_bGroupContentsChanged = true;
        }
Пример #4
0
        private void button_groupContents_new_Click(object sender, EventArgs e)
        {
            CellLineDialog dlg = new CellLineDialog();
            MainForm.SetControlFont(dlg, this.Font, false);

            dlg.FillGroupFieldNameTable();
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
                return;

            // 查重?
            // 名称查重
            ListViewItem dup = ListViewUtil.FindItem(this.listView_groupContents_lines, dlg.FieldName, 0);
            if (dup != null)
            {
                // 让操作者能看见已经存在的行
                ListViewUtil.SelectLine(dup, true);
                dup.EnsureVisible();

                DialogResult result = MessageBox.Show(this,
                    "当前已经存在名为 '" + dlg.FieldName + "' 的内容行。继续新增?",
                    "BindingOptionDialog",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button2);
                if (result == DialogResult.No)
                    return;
            }



            ListViewItem item = new ListViewItem();
            item.Text = dlg.FieldName;
            ListViewUtil.ChangeItemText(item, 1, dlg.Caption);

            this.listView_groupContents_lines.Items.Add(item);
            ListViewUtil.SelectLine(item, true);
            item.EnsureVisible();

            listView_groupContents_lines_SelectedIndexChanged(sender, null);

            this.m_bGroupContentsChanged = true;
        }