[system.runtime.interopservices.dllimport("gdi32.dll")]
public static extern long bitblt (intptr hdcdest, int nxdest, int nydest, int nwidth, int nheight, intptr hdcsrc, int nxsrc, int nysrc, int dwrop);
private bitmap memoryimage;
private void capturescreen()
{
graphics mygraphics = this.creategraphics();
size s = this.size;
memoryimage = new bitmap(s.width, s.height, mygraphics);
graphics memorygraphics = graphics.fromimage(memoryimage);
intptr dc1 = mygraphics.gethdc();
intptr dc2 = memorygraphics.gethdc();
bitblt(dc2, 0, 0, this.clientrectangle.width, this.clientrectangle.height, dc1, 0, 0, 13369376);
mygraphics.releasehdc(dc1);
memorygraphics.releasehdc(dc2);
}
private void printdocument1_printpage(system.object sender, system.drawing.printing.printpageeventargs e)
{
e.graphics.drawimage(memoryimage, 0, 0);
}
private void printbutton_click(system.object sender, system.eventargs e)
{
capturescreen();
printpreviewdialog1.show();
}
C#中如何对当前窗体进行打印预览-.NET教程,C#语言
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » C#中如何对当前窗体进行打印预览-.NET教程,C#语言
相关推荐
- 暂无文章
