在特定选项卡中打印多页富文本框 C#
我正在做一个带有多个选项卡的网络浏览器,每个选项卡可能会有一个与其他选项卡不同的新网站。 现在我想做的是在特定选项卡上打印页面,当我尝试打印时该页面可能包含多个页面。 这是我的代码,代码的问题是它只打印一页并且在最后一个选项卡上已打开。任何建议:
//this is the printDocemnt from the toolbox
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Font font1 = new Font("Arial", 16, FontStyle.Regular);
e.Graphics.DrawString(rtb.Text, font1, Brushes.Black, 100, 100);//rtb.Text is a richtextbox object that i initialize in the beginning of the form
}
//this is the printbutton just a normal button
private void PrintButton_Click(object sender, EventArgs e)
{
printDialog1.ShowDialog();
printDocument1.Print();
}
I am doing a web browser with multiple tabs and each tab probably will have a new website differs from the other tabs.
now what i am trying to do is to print the page on a specific tab and the page might consists of multiple pages when i am trying to print.
this is my code and the problem with the code is it is only printing one page and on the last tab had been opened. any suggestions:
//this is the printDocemnt from the toolbox
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Font font1 = new Font("Arial", 16, FontStyle.Regular);
e.Graphics.DrawString(rtb.Text, font1, Brushes.Black, 100, 100);//rtb.Text is a richtextbox object that i initialize in the beginning of the form
}
//this is the printbutton just a normal button
private void PrintButton_Click(object sender, EventArgs e)
{
printDialog1.ShowDialog();
printDocument1.Print();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我就是这样做的:打印文档包含以下代码:
这是打印按钮:
This is how i did it: the Print document contains this code:
this is the print button: