.net winform 打印窗体的方法(摘自VS2005帮助文档);
来源:互联网 发布:手机淘宝店铺公告制作 编辑:程序博客网 时间:2024/05/16 07:34
[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();
printDocument1.Print();
}
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();
printDocument1.Print();
}
- .net winform 打印窗体的方法(摘自VS2005帮助文档);
- WinForm+VS2005下ReportViewer的打印问题
- VS2005和Delphi2006帮助,MSDN,.net framework sdk文档不能显示的问题
- WinForm窗体间传值的方法
- WinForm窗体间传值的方法
- WinForm窗体间传值的方法
- WinForm 添加帮助文档
- WinForm 添加帮助文档
- 打印WinForm窗体,复制窗体。
- 打印 WinForm 窗体
- C# winform 窗体打印
- vs2005 winform窗体怎样打包
- vs2005和sql2005 联机丛书(帮助文档) 打不开解决方法
- WinForm窗体之间交互的一些方法(转)
- c# winform 用子窗体刷新父窗体,子窗体改变父窗体控件的值两种方法(1)
- c# winform 用子窗体刷新父窗体,子窗体改变父窗体控件的值两种方法(2)
- winform里用帮助文档
- 详解WinForm窗体间交互的方法
- Community Server专题八:MemberRole之Membership
- 打印网页中特定内容
- Community Server专题七: Job & Timer
- SAMBA设置全过程
- 前言
- .net winform 打印窗体的方法(摘自VS2005帮助文档);
- 享受 UNIX操作系统设计 一书
- SSH登陆修改端口
- Community Server专题六:Delegates & Events
- Community Server专题一:概述Community Server
- php 给图片加水印的函数
- 一个对象集合排序的类
- Visual C#常用函数和方法集汇总
- 记忆卡的区别