コード例 #1
0
        private void btnSaveTemplate_Click(object sender, EventArgs e)
        {
            if (gvColumnView.RowCount <= 0) {
                MessageBox.Show("Please add one or more fields in the Columns In View grid first.", "Save Template", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (!ValidateColumnsInView()) return;
            if (!AllowedSaveTempalte()) {
                MessageBox.Show("Dialog field components is not allowed to save as a template. Please remove any dialog related fields first before saving as a template.",
                    "Save Template", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            System.IO.StringWriter writer = new System.IO.StringWriter();
            DataSet dsResult = null;
            if (dtColumnsInView.DataSet == null) {
                dsResult = new DataSet("view");
                dsResult.Tables.Add(dtColumnsInView);
            } else {
                dsResult = dtColumnsInView.DataSet;
            }
            dsResult.WriteXml(writer, XmlWriteMode.IgnoreSchema);
            var xmlConfig = writer.ToString();

            PopupDialog diag = new PopupDialog();
            diag.MaximizeBox = false;
            diag.MinimizeBox = false;
            ViewTemplate template = new ViewTemplate(false);
            template.XMLConfig = xmlConfig;
            diag.Controls.Add(template);
            template.Dock = DockStyle.Fill;
            Size mSize = new Size(template.Width + 10, template.Height + 50);
            diag.Size = mSize;
            diag.MinimumSize = mSize;
            diag.Text = "Save Grid Report Template";
            diag.StartPosition = FormStartPosition.CenterScreen;
            diag.ShowDialog();
        }
コード例 #2
0
 private void btnLoadTemplate_Click(object sender, EventArgs e)
 {
     PopupDialog diag = new PopupDialog();
     diag.MaximizeBox = false;
     diag.MinimizeBox = false;
     ViewTemplate template = new ViewTemplate(true);
     template.ViewConfigurationModule = this;
     diag.Controls.Add(template);
     template.Dock = DockStyle.Fill;
     Size mSize = new Size(template.Width + 10, template.Height + 50);
     diag.Size = mSize;
     diag.MinimumSize = mSize;
     diag.Text = "Load Grid Report Template";
     diag.StartPosition = FormStartPosition.CenterScreen;
     diag.ShowDialog();
 }