打印与打印在 C# 中打印预览位图和带有文本的标签
我在程序中创建了一个函数,可以打印位图和图片框中的图像,但现在也想打印带有文本的标签。这是我当前的代码:
private void printToolStripMenuItem_Click(object sender, EventArgs e)
{
if (printDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
printDocument1.Print();
}
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(capturebox.BackgroundImage, 0, 0);
e.ToString(ExtraNotes.Text);
e.Graphics.DrawImage(capturebox.Image, 0, 0);
}
我的标签称为 ExtraNotes,我的图片框是 capturebox。
我希望能够将标签内容打印在图像的侧面或下方,我不介意。
我还希望能够使用打印预览对话框来打印预览,我不知道如何显示它,我可以打开它但不显示我想要的东西。
I have made a function in my program that will print off bitmaps and a image from a picturebox, but now want to print a label with text in it as well. This is my current code:
private void printToolStripMenuItem_Click(object sender, EventArgs e)
{
if (printDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
printDocument1.Print();
}
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(capturebox.BackgroundImage, 0, 0);
e.ToString(ExtraNotes.Text);
e.Graphics.DrawImage(capturebox.Image, 0, 0);
}
My label is called ExtraNotes, and my picturebox is capturebox.
I want to be able to print both of these with the label contents either to the side or below the image, i don't mind.
I also want to be able to print preview this using a print preview dialog of which i don't know how to make show this, i can get it to open but not show the things i want it to.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您的意思是这样做:
您可以更改文本所在位置的坐标。
I think you meant to do this:
You can change the corrdinates of where you want the text to go.