using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Printing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsPrintPageSetupDialog { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { pageSetupDialog1.Document = printDocument1; //启用边距 this.pageSetupDialog1.AllowMargins = true; //启用边距 this.pageSetupDialog1.AllowOrientation = true; //启用对话框的方向部分 this.pageSetupDialog1.AllowPaper = true; //启用对话框的纸张部分 this.pageSetupDialog1.AllowPrinter = true; //表示打印机的启动按钮 //显示页面设置对话框 this.pageSetupDialog1.ShowDialog(); } } }