c# winform 程序 怎么打印 Panel 或者Picturebox 里的内容。

2024-12-28 05:36:18
推荐回答(3个)
回答1:

private void button1_Click(object sender, EventArgs e)
{
printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.pd_PrintPage);
printDocument1.Print();
}
private void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(pictureBox1.Image, 0, 0, pictureBox1.Image.Width, pictureBox1.Image.Height);
}

回答2:

不难吧,先获取Panel的矩形,然后用drawImage画出图片,进行打印

回答3:

由第三方的插件,可以去网上找找看,自己写的话太麻烦...