0
我下面的代碼正在爲整個屏幕截圖,但我想採取截圖與預先設定的區域。我更喜歡點擊一個按鈕,然後拖動並選擇我想抓取x,y,destinationX,destinationY值的區域。有人可以給我一個提示或示例如何做到這一點?
bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height,
PixelFormat.Format32bppArgb);
// Create a graphics object from the bitmap
gfxScreenshot = Graphics.FromImage(bmpScreenshot);
// Take the screenshot from the upper left corner to the right bottom corner
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,
Screen.PrimaryScreen.Bounds.Y,
0,
0,
Screen.PrimaryScreen.Bounds.Size,
CopyPixelOperation.SourceCopy);