Possible Duplicate:
.NET Equivalent of Snipping Tool
My code below is taking screenshot for the whole screen, but I would like to take a screenshot with a pre-defined region. I prefer to click on a button then drag and select the region I want to grab x, y, destinationX, destinationY value. Can someone give me a hint or sample how to do that?
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);