日期:2014-05-18 浏览次数:20943 次
private void button2_Click(object sender, EventArgs e) { PrintPreviewDialog pd = new PrintPreviewDialog(); pd.Document = new PrintDocument(); pd.Document.PrintPage += new PrintPageEventHandler(Document_PrintPage); pd.Document.BeginPrint += new PrintEventHandler(Document_BeginPrint); if (pd.ShowDialog(this) == DialogResult.OK) { } } void Document_BeginPrint(object sender, PrintEventArgs e) { } int i = 0; void Document_PrintPage(object sender, PrintPageEventArgs e) { e.Graphics.DrawString("测试", this.Font, SystemBrushes.ControlText, Rectangle.FromLTRB(10, 10, 80, 80)); e.HasMorePages = i<10; i++; }