/// <summary> /// Handles the Load event of the MainForm control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void MainForm_Load(object sender, System.EventArgs e) { try { webcam = new Webcam(this); webcam.SetPreviewCallback(PreviewCallback); } catch (CamException ex) { webcam = null; labelError.Text = "Error: " + ex.Message; labelError.Visible = true; } }