设备的开启与操作: 开启多台设备

这个示例程序演示的是如何同时开启两台视频设备并将其实时画面显示在计算机屏幕上。
语言:.NET C#/Visual Basic
版本:3.0.3
发布于:2005年4月7日
作者:IC Imaging Control 技术支持部
系统要求:IC Imaging Control >2.1
由WDM数据流类驱动程序驱动的相机、视频转换器或图像采集卡

程序窗体如图所示:

The dialog window of the sample application.

首先在程序窗体中放置两个 IC Imaging Controls 控件,每台相机各有一个。对于每个 IC Imaging Control,都有一个按钮用于开启设备。

用户点击这两个按钮中的任何一个,正在播放现场画面的视频设备将被停止(.LiveStop),而后程序调用内置对话框(.ShowDeviceSettingsDialog)选择设备。 如所选设备有效,(.LiveStart)将开启视频数据流。

第一个按钮的事件处理程序如下:

[C#]
private void buttonOpenDevice1_Click(object sender, System.EventArgs e)
{
    if( icImagingControl1.LiveVideoRunning )
        icImagingControl1.LiveStop();

    icImagingControl1.ShowDeviceSettingsDialog();

    if( icImagingControl1.DeviceValid )
        icImagingControl1.LiveStart();
}
[VB.NET]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    If IcImagingControl1.LiveVideoRunning Then
        IcImagingControl1.LiveStop()
    End If

    IcImagingControl1.ShowDeviceSettingsDialog()

    If IcImagingControl1.DeviceValid Then
        IcImagingControl1.LiveStart()
    End If

End Sub

第二个按钮的事件处理程序也类似:

[C#]
private void buttonOpenDevice2_Click(object sender, System.EventArgs e)
{
    if( icImagingControl2.LiveVideoRunning )
        icImagingControl2.LiveStop();

    icImagingControl2.ShowDeviceSettingsDialog();

    if( icImagingControl2.DeviceValid )
        icImagingControl2.LiveStart();
}

[VB.NET]
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

    If IcImagingControl2.LiveVideoRunning Then
        IcImagingControl2.LiveStop()
    End If

    IcImagingControl2.ShowDeviceSettingsDialog()

    If IcImagingControl2.DeviceValid Then
        IcImagingControl2.LiveStart()
    End If

End Sub

相关源代码示例

责任声明
IC Imaging Control 源代码库中的所有代码均只用于教学目的,The Imaging Source Europe GmbH 作为IC Imaging Control的开发制造商,不对任何由于使用本文或其中源代码所产生的后果承担责任。

该网站为The Imaging Source网络的一部分。其它的站点包括 公司, Imaging, 天文相机, Astronomy Cameras Blog, Blog caméras d'astronomie, 天文相机有奖竞答, TX Text Control, LiveDocx, phpLiveDocxForum.