private void bnDevice_Click(object sender, EventArgs e) { DeviceForm dlg = new DeviceForm(); // Highlight current device in listbox dlg.SelectIndex(m_dev); // Put up the dialog to select a device DialogResult x = dlg.ShowDialog(this); // If a device is selected if (x == DialogResult.OK) { // Store the device m_dev = ((VDevice)dlg.lbDevices.SelectedItem).Device; // Create the capture graphs from the selected device try { m_Previewer.SelectDevice(m_dev, gbPreview.Handle); } catch (Exception ex) { MessageBox.Show(ex.Message, "GMFPreview capture", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void bnDevice_Click(object sender, EventArgs e) { DeviceForm dlg = new DeviceForm(); // Highlight current device in listbox dlg.SelectIndex(m_dev); // Put up the dialog to select a device DialogResult x = dlg.ShowDialog(this); // If a device is selected if (x == DialogResult.OK) { // Store the device m_dev = ((VDevice)dlg.lbDevices.SelectedItem).Device; // Create the capture graphs from the selected device try { m_Previewer.SelectDevice(m_dev, gbPreview.Handle); } catch(Exception ex) { MessageBox.Show(ex.Message, "GMFPreview capture", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }