Exemple #1
0
        void menu_newColumn_Click(object sender, EventArgs e)
        {
            ReportColumnDialog dlg = new ReportColumnDialog();
            MainForm.SetControlFont(dlg, this.Font, false);
            if (this.AppInfo != null)
                this.AppInfo.LinkFormState(dlg, "ReportColumnDialog_state");
            dlg.ShowDialog(this);
            if (this.AppInfo != null)
                this.AppInfo.UnlinkFormState(dlg);

            if (dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                return;

            ListViewItem item = new ListViewItem();
            ListViewUtil.ChangeItemText(item, COLUMN_NAME, dlg.ColumnName);
            ListViewUtil.ChangeItemText(item, COLUMN_DATATYPE, dlg.DataType);
            ListViewUtil.ChangeItemText(item, COLUMN_ALIGN, dlg.ColumnAlign);
            ListViewUtil.ChangeItemText(item, COLUMN_CSSCLASS, dlg.CssClass);
            ListViewUtil.ChangeItemText(item, COLUMN_SUM, dlg.ColumnSum == true ? "yes" : "no");
            ListViewUtil.ChangeItemText(item, COLUMN_EVAL, dlg.Eval);

            this.listView_columns.Items.Add(item);
            ListViewUtil.SelectLine(item, true);
        }
Exemple #2
0
        void menu_modifyColumn_Click(object sender, EventArgs e)
        {
            string strError = "";
            // int nRet = 0;

            if (this.listView_columns.SelectedItems.Count == 0)
            {
                strError = "尚未选定要修改的事项";
                goto ERROR1;
            }

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

            ReportColumnDialog dlg = new ReportColumnDialog();
            MainForm.SetControlFont(dlg, this.Font, false);
            dlg.ColumnName = ListViewUtil.GetItemText(item, COLUMN_NAME);
            dlg.DataType = ListViewUtil.GetItemText(item, COLUMN_DATATYPE);
            dlg.ColumnAlign = ListViewUtil.GetItemText(item, COLUMN_ALIGN);
            dlg.CssClass = ListViewUtil.GetItemText(item, COLUMN_CSSCLASS);
            dlg.ColumnSum = StringUtil.GetBooleanValue(
                ListViewUtil.GetItemText(item, COLUMN_SUM),
                true);
            dlg.Eval = ListViewUtil.GetItemText(item, COLUMN_EVAL);

            if (this.AppInfo != null)
                this.AppInfo.LinkFormState(dlg, "ReportColumnDialog_state");
            dlg.ShowDialog(this);
            if (this.AppInfo != null)
                this.AppInfo.UnlinkFormState(dlg);

            if (dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                return;

            ListViewUtil.ChangeItemText(item, COLUMN_NAME, dlg.ColumnName);
            ListViewUtil.ChangeItemText(item, COLUMN_DATATYPE, dlg.DataType);
            ListViewUtil.ChangeItemText(item, COLUMN_ALIGN, dlg.ColumnAlign);
            ListViewUtil.ChangeItemText(item, COLUMN_CSSCLASS, dlg.CssClass);
            ListViewUtil.ChangeItemText(item, COLUMN_SUM, dlg.ColumnSum == true ? "yes" : "no");
            ListViewUtil.ChangeItemText(item, COLUMN_EVAL, dlg.Eval);
            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }