public static Rectangle Snip() { var rc = Screen.PrimaryScreen.Bounds; using (Bitmap bmp = new Bitmap(rc.Width, rc.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb)) { using (Graphics gr = Graphics.FromImage(bmp)) gr.CopyFromScreen(0, 0, 0, 0, bmp.Size); using (var snipper = new SnippingTool(bmp)) { if (snipper.ShowDialog() == DialogResult.OK) { return(snipper.rcSelect); } } return(Rectangle.Empty); } }
private void button1_Click_1(object sender, EventArgs e) { rectangle = SnippingTool.Snip(); }