c# 窗体截图
/// <summary> /// 可以捕获超出屏幕大小的的截图 /// </summary> /// <param name="hWnd"></param> /// <returns></returns> public static Image CaptureWindowScreen(IntPtr hWnd) { RECT rect = new RECT(); GetWindowRect(hWnd, ref rect); var width = rect.right - rect.left; var height = rect.bottom - rect.top; Image myImage = new Bitmap(width, height); Graphics myGraphics = Graphics.FromImage(myImage); var hdc = myGraphics.GetHdc(); PrintWindow(hWnd, hdc, 0); myGraphics.Dispose(); return myImage; }
桂棹兮兰桨,击空明兮溯流光。