【求助】怎么把一个FORM里面的内容,都保存到一个BMP图片文件中去? 请问:怎么把一个FORM里面的内容,都保存到一个BMP图片文件中去?谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考这里:http://s5689412.cnblogs.com/archive/2005/10/26/262258.html IntPtr dc = GetDC(IntPtr.Zero); Graphics dcG = Graphics.FromHwnd(IntPtr.Zero); Bitmap bmp = new Bitmap(Width,Height,dcG); Graphics bmpG = Graphics.FromImage(bmp); IntPtr hdcDest = bmpG.GetHdc(); BitBlt(hdcDest,0,0,bmp.Width,bmp.Height,dc,Left,Top,0x00CC0020); bmpG.ReleaseHdc(hdcDest); bmpG.Dispose(); bmp.Save(@"c:\zlc.bmp",System.Drawing.Imaging.ImageFormat.Bmp); bmp.Dispose(); dcG.Dispose(); ReleaseDC(IntPtr.Zero,dc); api声明 [DllImport("user32.dll", CharSet=CharSet.Auto)] static public extern IntPtr GetDC(IntPtr hWnd); [DllImport("user32.dll", CharSet=CharSet.Auto)] static public extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); [DllImport("gdi32.dll", CharSet=CharSet.Auto)] static public extern bool BitBlt(IntPtr hdcDest, // handle to destination device context int nXDest, // x-coordinate of destination rectangle's upper-left corner int nYDest, // y-coordinate of destination rectangle's upper-left corner int nWidth, // width of destination rectangle int nHeight, // height of destination rectangle IntPtr hdcSrc, // handle to source device context int nXSrc, // x-coordinate of source rectangle's upper-left corner int nYSrc, // y-coordinate of source rectangle's upper-left corner uint dwRop); // raster operation code ); C#数据导入数据库时太慢 new Bitmap(fileName);写在控件的构造函数里出错 请问一个TopToolStripPanel容器问题. 程序异常问题,高分请教 如何计算一个人的岁数? c#和SQL查询 socket通信中的同步与异步、阻塞与非阻塞的区别? 请问,有没有办法让用户手工调整控件的大小? WEBCONFIG 的连接字符串,,急急!!! 窗口的固定显示 关于验证输入框的问题,请指点迷津。 写入数据库时候的错误
http://s5689412.cnblogs.com/archive/2005/10/26/262258.html
Graphics dcG = Graphics.FromHwnd(IntPtr.Zero);
Bitmap bmp = new Bitmap(Width,Height,dcG);
Graphics bmpG = Graphics.FromImage(bmp);
IntPtr hdcDest = bmpG.GetHdc();
BitBlt(hdcDest,0,0,bmp.Width,bmp.Height,dc,Left,Top,0x00CC0020);
bmpG.ReleaseHdc(hdcDest);
bmpG.Dispose();
bmp.Save(@"c:\zlc.bmp",System.Drawing.Imaging.ImageFormat.Bmp);
bmp.Dispose();
dcG.Dispose();
ReleaseDC(IntPtr.Zero,dc);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static public extern IntPtr GetDC(IntPtr hWnd); [DllImport("user32.dll", CharSet=CharSet.Auto)]
static public extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("gdi32.dll", CharSet=CharSet.Auto)]
static public extern bool BitBlt(IntPtr hdcDest, // handle to destination device context
int nXDest, // x-coordinate of destination rectangle's upper-left corner
int nYDest, // y-coordinate of destination rectangle's upper-left corner
int nWidth, // width of destination rectangle
int nHeight, // height of destination rectangle
IntPtr hdcSrc, // handle to source device context
int nXSrc, // x-coordinate of source rectangle's upper-left corner
int nYSrc, // y-coordinate of source rectangle's upper-left corner
uint dwRop); // raster operation code );