日期:2014-05-17 浏览次数:21404 次
PageSetupDialog PageSetupDialog1 = new PageSetupDialog(); PageSetupDialog1.Document = new System.Drawing.Printing.PrintDocument(); //指定Margin PageSetupDialog1.PageSettings.Margins = new System.Drawing.Printing.Margins(100, 100, 100, 100); if (System.Globalization.RegionInfo.CurrentRegion.IsMetric) { PageSetupDialog1.PageSettings.Margins.Top = (int)Math.Round( PageSetupDialog1.PageSettings.Margins.Top * 2.54); PageSetupDialog1.PageSettings.Margins.Bottom = (int)Math.Round( PageSetupDialog1.PageSettings.Margins.Bottom * 2.54); PageSetupDialog1.PageSettings.Margins.Left = (int)Math.Round( PageSetupDialog1.PageSettings.Margins.Left * 2.54); PageSetupDialog1.PageSettings.Margins.Right = (int)Math.Round( PageSetupDialog1.PageSettings.Margins.Right * 2.54); } //表示页面设置窗体 if (PageSetupDialog1.ShowDialog() == DialogResult.OK) Console.WriteLine(PageSetupDialog1.PageSettings.Margins); else if (System.Globalization.RegionInfo.CurrentRegion.IsMetric) { //返回原设置 PageSetupDialog1.PageSettings.Margins.Top = (int)Math.Round( PageSetupDialog1.PageSettings.Margins.Top / 2.54); PageSetupDialog1.PageSettings.Margins.Bottom = (int)Math.Round( PageSetupDialog1.PageSettings.Margins.Bottom / 2.54); PageSetupDialog1.PageSettings.Margins.Left = (int)Math.Round( PageSetupDialog1.PageSettings.Margins.Left / 2.54); PageSetupDialog1.PageSettings.Margins.Right = (int)Math.Round( PageSetupDialog1.PageSettings.Margins.Right / 2.54); }
------解决方案--------------------
UP