Exemplo n.º 1
0
        /// <summary>
        /// Do it....
        /// </summary>
        public MainForm()
        {
            InitializeComponent();
            pathName = String.Format("{0}\\Data\\", Path.GetDirectoryName(Application.ExecutablePath));
            if (! Directory.Exists(pathName))
            {
                Directory.CreateDirectory(pathName);
            }

            handlers = new ImageFormatHandler();
            capture = new ScreenCapture(handlers);
        }
Exemplo n.º 2
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.");
         }
     }
 }