// 修改名字和注释
        void menu_Modify(object sender, System.EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选择拟修改的模板记录事项...");
                return;
            }
            TemplateRecordDialog dlg = new TemplateRecordDialog();

            // string strOldName = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0);

            dlg.TemplateName    = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0);
            dlg.TemplateComment = ListViewUtil.GetItemText(listView1.SelectedItems[0], 1);

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

            ListViewUtil.ChangeItemText(this.listView1.SelectedItems[0], 0, dlg.TemplateName);
            ListViewUtil.ChangeItemText(this.listView1.SelectedItems[0], 1, dlg.TemplateComment);

            this.Changed = true;
        }
예제 #2
0
        // 修改名字和注释
        void menu_Modify(object sender, System.EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选择拟修改的模板记录事项...");
                return;
            }
            TemplateRecordDialog dlg = new TemplateRecordDialog();

            // string strOldName = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0);

            dlg.TemplateName = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0);
            dlg.TemplateComment = ListViewUtil.GetItemText(listView1.SelectedItems[0], 1);

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

            ListViewUtil.ChangeItemText(this.listView1.SelectedItems[0], 0, dlg.TemplateName);
            ListViewUtil.ChangeItemText(this.listView1.SelectedItems[0], 1, dlg.TemplateComment);

            this.Changed = true;
        }