private void HeaderFooter_Click(object sender, EventArgs e) { HeaderFooterDialog dlgHF = new HeaderFooterDialog(); dlgHF.Header = diagram1.Model.HeaderFooterData.Header; dlgHF.Footer = diagram1.Model.HeaderFooterData.Footer; dlgHF.MeasurementUnits = diagram1.Model.MeasurementUnits; if (dlgHF.ShowDialog() == DialogResult.OK) { diagram1.Model.HeaderFooterData.Header = dlgHF.Header; diagram1.Model.HeaderFooterData.Footer = dlgHF.Footer; } }
private void FileItem_Click(object sender, EventArgs e) { ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem; switch (toolStripMenuItem.Tag.ToString()) { case "Header Footer": { if (this.diagram1 != null && this.diagram1.Model != null) { HeaderFooterDialog dlgHF = new HeaderFooterDialog(); dlgHF.Header = this.diagram1.Model.HeaderFooterData.Header; dlgHF.Footer = this.diagram1.Model.HeaderFooterData.Footer; dlgHF.MeasurementUnits = this.diagram1.Model.MeasurementUnits; if (dlgHF.ShowDialog() == DialogResult.OK) { this.diagram1.Model.HeaderFooterData.Header = dlgHF.Header; this.diagram1.Model.HeaderFooterData.Footer = dlgHF.Footer; } } } break; case "Page Borders": { if (this.diagram1 != null && this.diagram1.View != null) { PageBorderDialog borderDialog = new PageBorderDialog(); borderDialog.PageBorderStyle = this.diagram1.View.PageBorderStyle; if (borderDialog.ShowDialog() == DialogResult.OK) { this.diagram1.View.PageBorderStyle = borderDialog.PageBorderStyle; } } } break; case "Page Setup": { if (this.diagram1 != null && this.diagram1.Model != null) { PageSetupDialog dlgPrintSetup = new PageSetupDialog(diagram1.View); // Made to make values more user friendly dlgPrintSetup.PrintSettings = this.diagram1.View.PageSettings; dlgPrintSetup.PrintZoom = this.diagram1.View.PrintZoom; if (dlgPrintSetup.ShowDialog() == DialogResult.OK) { this.diagram1.View.PageSettings = dlgPrintSetup.PrintSettings; this.diagram1.View.PrintZoom = dlgPrintSetup.PrintZoom; this.diagram1.View.RefreshPageSettings(); } } } break; case "Print Preview": { this.PrintPreview(); } break; case "Print": { this.Print(); } break; } }