Ejemplo n.º 1
0
        private void btn_capture_Click(object sender, EventArgs e)
        {
            _captureScreen = new Capture();
            _captureArea   = new CaptureArea();

            if (rb_current.Checked == true)
            {
                _captureScreen.CaptureCurrentScreen(this);
            }
            else if (rb_select.Checked == true)
            {
                if (_captureArea.ShowDialog() == DialogResult.OK)
                {
                    Rectangle rect = _captureArea.ResultRect;
                    _captureScreen.CaptureArea(this, rect);
                }

                _captureArea.Dispose();
            }
            else if (rb_application.Checked == true && cb_processes.SelectedItem != null)
            {
                IntPtr hwnd = FindWindow(null, cb_processes.SelectedItem.ToString());

                if (!IsAppMinimized(hwnd))
                {
                    _captureScreen.CaptureWindow(hwnd, cb_processes.SelectedItem.ToString());
                }
                else
                {
                    MessageBox.Show("Error: Application is minimized.");
                }
            }
            else if (rb_application.Checked == true && cb_processes.SelectedItem == null)
            {
                MessageBox.Show("Please select an applicatiom from list.");
            }
        }