/// <summary> /// Constructor /// </summary> public MainForm() { InitializeComponent(); // Check to see what video inputs we have available. this.videoDevices = this.GetDevices(); if (videoDevices.Length == 0) { DialogResult res = MessageBox.Show("A camera device was not detected. Do you want to exit?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == System.Windows.Forms.DialogResult.Yes) { Application.Exit(); } } else if (videoDevices.Length < 2) { DialogResult res = MessageBox.Show("Only 1 camera detected. Stero Imaging can not be emulated. Do you want to exit?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == System.Windows.Forms.DialogResult.Yes) { Application.Exit(); } } // Add cameras to the menus. this.AddCameras(this.videoDevices, this.mItLeft, this.mItCaptureLeft_Click); this.AddCameras(this.videoDevices, this.mItRight, this.mItCaptureRight_Click); // Add ports to the menu items. this.SearchForPorts(); // Set up chessboard drawing array. Random R = new Random(); for (int i = 0; i < lineColours.Length; i++) { this.lineColours[i] = new Bgr(R.Next(0, 255), R.Next(0, 255), R.Next(0, 255)); } // Frame acquirer timer. this.frameAcquirer.Stop(); this.frameAcquirer.Tick += this.frameAcquirer_Tick; this.frameAcquirer.Interval = 10; this.frameAcquirer.Start(); // this.progresForm.FormClosing += progresForm_FormClosing; this.progresForm.SetValue(0); // Attach keyboard strokes events. KeystrokMessageFilter kbMsg = new KeystrokMessageFilter(); kbMsg.OnOpenReald3D += kbMsg_OnOpenReald3D; kbMsg.OnOpenAnaglyph += kbMsg_OnOpenAnaglyph; kbMsg.OnExitForm += kbMsg_OnExitForm; kbMsg.OnFullScreen += kbMsg_OnFullScreen; // Attach the handler. Application.AddMessageFilter(kbMsg); }
/// <summary> /// 构造 /// </summary> public frmFormDesign() { InitializeComponent(); _KeyStrokeMessageFilter = new KeystrokMessageFilter(); Application.AddMessageFilter(_KeyStrokeMessageFilter); this.Width = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width; this.Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - 5; }