C# 打印窗口

2021-01-28 12:17

阅读:479

标签:rom   打印   width   val   screen   graphic   int   click   from   

private void cmd_prn_Click(object sender, EventArgs e)
{
if (printDoc.PrinterSettings.IsValid == false) return;
Graphics myGraphics = this.CreateGraphics();
Size s = this.Size;
memoryImage = new Bitmap(s.Width, s.Height, myGraphics);
Graphics memoryGraphics = Graphics.FromImage(memoryImage);
memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);

printDoc.Print();
}

 

 printDoc_PrintPage事件添加:

private void printDoc_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawImage(memoryImage, 0, 0);
}

C# 打印窗口

标签:rom   打印   width   val   screen   graphic   int   click   from   

原文地址:https://www.cnblogs.com/-jwj/p/11891327.html


评论


亲,登录后才可以留言!