标签:wstring control end click 设置 images res menu div
使用打印控件首先需要先创建printdocument对象:使用printpage触发事件
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Font f=new System.Drawing.Font("宋体",13); Brush b=new SolidBrush(Color.Black); e.Graphics.DrawString(richTextBox1.Text, f, b, 10, 10); }
打印设置:pagesetupdialog
private void 打印设置ToolStripMenuItem_Click(object sender, EventArgs e) { pageSetupDialog1.Document = printDocument1; pageSetupDialog1.ShowDialog(); }
打印预览:弹出对话框printpreviewdialog
private void 打印预览VToolStripMenuItem_Click(object sender, EventArgs e) { printPreviewDialog1.Document = printDocument1; printPreviewDialog1.ShowDialog(); }
打印预览:不弹出对话框printpreviewcontrol
private void button1_Click(object sender, EventArgs e) { printPreviewControl1.Document = printDocument1; }
打印:printdialog
private void 打印PToolStripMenuItem_Click(object sender, EventArgs e) { printDialog1.Document = printDocument1; DialogResult dr = printDialog1.ShowDialog(); if (dr == DialogResult.OK) { printDocument1.Print(); } }
标签:wstring control end click 设置 images res menu div
原文地址:http://www.cnblogs.com/wy1992/p/6160318.html