C# bitblt 做截图时在调用Bitblt时候速度没有加速??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Bitblt是GDI的函数,是硬件加速的,于用什么语言没啥关系。 但是我在Onpaint时调用。。没有一点加速啊 Graphics grDest = Graphics.FromHwnd(this.Handle); Graphics grSrc = Graphics.FromImage(bmp); IntPtr hdcDest = IntPtr.Zero; IntPtr hdcSrc = IntPtr.Zero; IntPtr hBitmap = IntPtr.Zero; IntPtr hOldObject = IntPtr.Zero; try { hdcDest = grDest.GetHdc(); hdcSrc = grSrc.GetHdc(); hBitmap = bmp.GetHbitmap(); hOldObject = SelectObject(hdcSrc, hBitmap); if (hOldObject == IntPtr.Zero) throw new Win32Exception(); if (!BitBlt(hdcDest, 0, 0, pictureBox1.Width, pictureBox1.Height, hdcSrc, 0, 0, 0x00CC0020U)) throw new Win32Exception(); } finally { if (hOldObject != IntPtr.Zero) SelectObject(hdcSrc, hOldObject); if (hBitmap != IntPtr.Zero) DeleteObject(hBitmap); if (hdcDest != IntPtr.Zero) grDest.ReleaseHdc(hdcDest); if (hdcSrc != IntPtr.Zero) grSrc.ReleaseHdc(hdcSrc); } C#如何点击按钮后,使得按钮变成一张图片 C#如何实现文件保存对话框自动保存 如何发出一个URL 水晶报表要显示几个数据表中数据,如何写条件 1.怎么用timer控件做一个时间控制器? 你人能给我介绍几本C#的书吗??? 关闭web程序的EXCEL进程问题 条件编译作用域的问题 C#中如何在摄像头的预览画面中画线 c# 屏幕录像 求高高手救命 来人啊 在线等待 论坛bug? MapXtreme 能够搭建WMS服务吗
Graphics grDest = Graphics.FromHwnd(this.Handle);
Graphics grSrc = Graphics.FromImage(bmp);
IntPtr hdcDest = IntPtr.Zero;
IntPtr hdcSrc = IntPtr.Zero;
IntPtr hBitmap = IntPtr.Zero;
IntPtr hOldObject = IntPtr.Zero;
try
{
hdcDest = grDest.GetHdc();
hdcSrc = grSrc.GetHdc();
hBitmap = bmp.GetHbitmap();
hOldObject = SelectObject(hdcSrc, hBitmap);
if (hOldObject == IntPtr.Zero)
throw new Win32Exception();
if (!BitBlt(hdcDest, 0, 0, pictureBox1.Width, pictureBox1.Height, hdcSrc, 0, 0, 0x00CC0020U))
throw new Win32Exception(); }
finally
{
if (hOldObject != IntPtr.Zero) SelectObject(hdcSrc, hOldObject);
if (hBitmap != IntPtr.Zero) DeleteObject(hBitmap);
if (hdcDest != IntPtr.Zero) grDest.ReleaseHdc(hdcDest);
if (hdcSrc != IntPtr.Zero) grSrc.ReleaseHdc(hdcSrc);
}