我想实现一个打印功能 在C#中如何实现打印功能呢?比如我有个文本在richtextbox中我只想打印richtextbox里面的内容如何实现这个功能呢如何使用printdialog和printpreviewdialog怎么才可以呢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 请参考:http://topic.csdn.net/u/20091129/20/0ff4234a-038e-485e-8e35-15820d4e8648.html第7,8楼。 private void button1_Click(object sender, EventArgs e) { System.Drawing.Printing.PrintDocument pd=new System.Drawing.Printing.PrintDocument(); pd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(pd_PrintPage); pd.Print(); } void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Single ypos = 0; Single leftmargin = e.MarginBounds.Left; Single topmargin = e.MarginBounds.Top; Single x=leftmargin; e.Graphics.DrawString(this.richTextBox1.Text, new System.Drawing.Font("宋体", 10), System.Drawing.Brushes.Black, x, ypos, new System.Drawing.StringFormat()); e.HasMorePages = false; } 操作excel文件怎么在末尾追加? asp 与 asp.net 结合 session 问题 [文章推荐]《你必须知道的.NET》!! 有没有谁用vs2005做过中英文切换呀或者怎么提取资源文件?help me! 实现鼠标左键单击同时引发右键单击! Winforms读取文件,文件安全属性需要哪些用户具备访问权力? 求regulator工具 请教! 两个表在DATASET中关联的问题 求高手看下,C#蓝牙 C# timer定时器只执行一次 把<option value='adm....这条语句改成c#脚本,怎么改?? 为什么不对在aspx页面switch
http://topic.csdn.net/u/20091129/20/0ff4234a-038e-485e-8e35-15820d4e8648.html
第7,8楼。
private void button1_Click(object sender, EventArgs e)
{ System.Drawing.Printing.PrintDocument pd=new System.Drawing.Printing.PrintDocument();
pd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(pd_PrintPage);
pd.Print();
} void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Single ypos = 0;
Single leftmargin = e.MarginBounds.Left;
Single topmargin = e.MarginBounds.Top; Single x=leftmargin;
e.Graphics.DrawString(this.richTextBox1.Text,
new System.Drawing.Font("宋体", 10),
System.Drawing.Brushes.Black, x, ypos,
new System.Drawing.StringFormat()); e.HasMorePages = false;
}