protected override void OnClosing(CancelEventArgs e) { if (_captureDevice != null) { _captureDevice.Stop(); } base.OnClosing(e); }