private void button1_Click(object sender, EventArgs e) { if (form != null) { try { ImageFormatHandler handlers = new ImageFormatHandler(); ScreenCapture capture = new ScreenCapture(handlers); pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize; pictureBox1.Image = capture.Capture(form, @"MbUnitFormsCapture\"); CompareControlCaptureAction action = new CompareControlCaptureAction(capture.LastCapture, null); writer.AddAction(action); textBox.Text = writer.Test; } catch (ObjectDisposedException) { MessageBox.Show("Please re-open your form."); } } }
private void button1_Click(object sender, EventArgs e) { if (form != null) { try { ImageFormatHandler handlers = new ImageFormatHandler(); ScreenCapture capture = new ScreenCapture(handlers); pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize; pictureBox1.Image = capture.Capture(form, @"MbUnitFormsCapture\" ); CompareControlCaptureAction action = new CompareControlCaptureAction(capture.LastCapture, null); writer.AddAction(action); textBox.Text = writer.Test; } catch(ObjectDisposedException) { MessageBox.Show("Please re-open your form."); } } }