在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
[DllImport("user32.dll")] public static extern bool PrintWindow( IntPtr hwnd, // Window to copy,Handle to the window that will be copied. IntPtr hdcBlt, // HDC to print into,Handle to the device context. UInt32 nFlags // Optional flags,Specifies the drawing options. It can be one of the following values. ); //传入窗口句柄,获取该窗口的图像信息 private Image GetWindowImage(IntPtr windownHandle) { Control control =Control.FromHandle(windownHandle); Bitmap image = new Bitmap(control.Width, control.Height); Graphics gp = Graphics.FromImage(image); IntPtr dc = gp.GetHdc(); PrintWindow(windownHandle, dc, 0); gp.ReleaseHdc(); gp.Dispose(); return image; }
|
请发表评论