Beispiel #1
0
 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, @"XunitFormsCapture\");
             CompareControlCaptureAction action = new CompareControlCaptureAction(capture.LastCapture, null);
             writer.AddAction(action);
             textBox.Text = writer.Test;
         }
         catch (ObjectDisposedException)
         {
             MessageBox.Show("Please re-open your form.");
         }
     }
 }
 public ScreenCapture(ImageFormatHandler formatHandler)
 {
     this.doc.PrintPage += new PrintPageEventHandler(this.printPage);
     this.formatHandler = formatHandler;
 }