当前位置:首页 > Windows程序 > 正文

C# 打印窗口

标签: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.jmwww.net/file/14163.html