C# Panel控件截图
2016-03-15 10:16
1331 查看
[System.Runtime.InteropServices.DllImportAttribute("gdi32.dll ")] private static extern bool BitBlt( IntPtr hdcDest, // handle to destination DC int nXDest, // x-coord of destination upper-left corner int nYDest, // y-coord of destination upper-left corner int nWidth, // width of destination rectangle int nHeight, // height of destination rectangle IntPtr hdcSrc, // handle to source DC int nXSrc, // x-coordinate of source upper-left corner int nYSrc, // y-coordinate of source upper-left corner System.Int32 dwRop // raster operation code );
Graphics g1 = panel1.CreateGraphics(); Image myImage = new Bitmap(this.panel1.Width, this.panel1.Height, g1); Graphics g2 = Graphics.FromImage(myImage); IntPtr dc1 = g1.GetHdc(); IntPtr dc2 = g2.GetHdc(); BitBlt(dc2, 0, 0, this.panel1.Width, this.panel1.Height, dc1, 0, 0, 13369376); g1.ReleaseHdc(dc1); g2.ReleaseHdc(dc2); myImage.Save(@"NewImage.bmp ", ImageFormat.Bmp);
相关文章推荐
- C#中AS和IS关键字的用法
- 你的C#代码是怎么跑起来的(二)
- .Net C# Task异步调用功能一例
- C# Language Specification
- C#中关于as关键字的使用
- [Songqw.Net 基础]C#实现简单的插件化开发,可用于WPF Winform.
- C#
- C#中的项目文件夹debug 和release的区别
- [转]仿World Wind构造自己的C#版插件框架——WW插件机制精简改造
- C#索引器
- c#类的属性和方法
- 【C#】 简单计算器设计 & 字符提取和整数整除练习
- 【C#进阶系列】11 事件
- 【C#进阶系列】10 事件
- C#中, 动态的将图片传递给ReportViewer中的报表.
- c# 数据类型占用字节数
- c#循环
- C#中小函数的应用
- EmguCV第一个程序,读入图像并显示
- 关于Emgu安装和使用中遇到的问题和解决办法