/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (cam != null) { cam.Dispose(); cam = null; } if (components != null) { components.Dispose(); } } base.Dispose( disposing ); }
private void button1_Click(object sender, System.EventArgs e) { const int VIDEODEVICE = 0; // zero based index of video capture device to use Cursor.Current = Cursors.WaitCursor; if (cam == null) { cam = new Capture(VIDEODEVICE, textBox1.Text); cam.Start(); button1.Text = "Stop"; textBox1.ReadOnly = true; } else { button1.Text = "Start"; textBox1.ReadOnly = false; // Pause the recording cam.Pause(); // Close it down cam.Dispose(); cam = null; } Cursor.Current = Cursors.Default; }