private void ButtonScreenshot_Click(object sender, EventArgs e) { Screenshot screenshot = new Screenshot(); Bitmap bitmap = screenshot.CaptureActiveWindow(); using (Form saveForm = new SaveForm(bitmap)) { saveForm.ShowDialog(); screenshot.Dispose(); } }
private void ButtonScreenshot_Click(object sender, EventArgs e) { Rectangle bounds = Bounds; using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height)) { using (Graphics g = Graphics.FromImage(bitmap)) { g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size); } using (Form saveForm = new SaveForm(bitmap)) { saveForm.ShowDialog(); } } }