在VS6.0年代,微软提供了VFW(Video For Window) 这样强大而方便的库来支持视频捕获和回放。但是无论是在。NET v1.0还是在.NET v2.0框架中,都没有提供相应的类库来支持视频捕获和回放。解决这个问题有很多种方法,比如利用平台调用P/Invoke对VFW中的功能函数进行封装,然后再C#中进行调用。这样效率很低并且太复杂。还可以利用第三方提供的ActiveX控件来实现这个功能,这有什么好处呢?简单!!!!这也就足够了。并且往往第三方提供的控件功能更强大。但是世界上没有免费的午餐——这种控件往往是要收费的。在这里肯定有的朋友会想到:“不是还可以利用DX(DirectX)来实现吗,微软也提供了Manager DX托管代码的SDK”。的确,利用DX来实现视频捕获和回放是一个很好的方法,无论从效率还是效果来说都是上上之选。不幸的是:微软虽然提供了D3D、DirectDraw、DirectSound、DirectPlayer......但是唯独没有我们感兴趣的,可以实现视频捕获的DirectShow的SDK。据我所知,国外有开源的代码对DirectShow进行了封装,我也用过,个人感觉还不错,有兴趣的朋友可以查找一下这方面的资料,这里我就不多说了。
言归正传,要利用ActiveX在C#中实现视频捕获,先要做好以下准备工作:
在VS2003中新建一个“
Windows 应用程序”工程,工程建立后,首先要向“工具箱”中添加ActiveX控件具体方法是在VS2003菜单的“工具”菜单中单击“
添加/移除工具箱项”。在弹出的对话框中选择“
COM 组件”选项卡,在下面的列表框中,将“
Pegasus Imaging CapturePRO Control v3.0”前面的复选框选中,然后单击“确定”返回编译器编辑界面就可以了。然后将刚刚添加的控件拖放到窗体上调整好大小和位置,在属性页中修改属性。修改属性的方法和普通控件一样,至于各个属性的含义可以参考控件的帮助文档。控件所有的方法、属性和事件在帮助文档中都有详细的说明。这里建议修改其“
Name”属性,方便以后操作,比如将
Name属性改为
axCap(以后axCap都表示该控件)。将
axCap的
Size属性改为
320,240。因为很多摄像头的默认分辨率是320X240。窗体布局大概如下图:
然后再窗体上放一个Button控件,在该控件的单击事件中添加以下代码:
private
void
butConnect_Click(
object
sender, System.EventArgs e)

...
{
axCap.Connect (0); // 连接到设备
axCap.Preview = true; // 开始预览
}
然后编译工程,允许程序,单击按钮应该就可以看到视频图像了。
到这里就表示我们的操作成功了,最基本的功能实现了,这里对上述两行代码进行简单的解释。第一行
axCap.Connect(0)表示将控件连接到设备0。在Windows中,可以同时支持多个视频设备,每个设备都有一个编号。第一个设备编号0,第二个设备编号1,依次类推。由于我的电脑上只连接了一个视频摄像头,所以视频设备的编号是0。这里也就可以看出Connect()函数的参数实际上就是视频设备的参数,至于怎样来确定视频设备对于得编号,下面会有详细的说明。第二行
axCap.Preview = true;表示打开预览。Preview属性为真时表示在控件上显示视频图像,当然要是该属性为false,我们就看不到视频了。
下面对一些常用的,比较重要的方法和属性进行说明:
怎样确定视频设备的编号:首先利用属性
axCap .NumDevices来获取Windows中可用视频设备的数目,然后利用方法
axCap .ObtainDeviceName (i)来获取该设备的名称字符串。其中参数i同Connect()函数一样,表示视频设备编号。具体的方法和实现过程可以参考以下代码:
//
判断有没用可用的捕获设备
if
(axCap .NumDevices
<
0
)
{
//
没有找到可用的视频设备则报错,并退出程序
MessageBox.Show (
"
没有发现可用的设备!
"
,
"
错误
"
,MessageBoxButtons.OK ,MessageBoxIcon.Error );
cobDevice.Items .Add(
"
未发现可用视频设备
"
);
cobDevice.SelectedIndex
=
0
;
}
else
{
//
找到则枚举所以设备,并初始化设备组合框
try
{
for
(
int
i
=
0
;i
<
axCap .NumDevices ;i
++
)
{
cobDevice.Items .Add (axCap .ObtainDeviceName (i));
}
cobDevice.SelectedIndex
=
0
;
//
设置默认设备
}
catch
{
MessageBox.Show (
"
初始化设备失败!
"
,
"
错误
"
,MessageBoxButtons.OK ,MessageBoxIcon.Error );
cobDevice.Items .Add(
"
未发现可用视频设备
"
);
cobDevice.SelectedIndex
=
0
;
}
}
怎样修改摄像头参数:每个摄像头都有很多参数,如亮度、对比度、灰度等。有的摄像还可能提供很多特效效果,比如像框,黑白等。这些参数和效果都可通过调用底层的视频设备属性对话框来修改,具体方法请参考以下代码:
private
void
butSet_Click(
object
sender, System.EventArgs e)
{
//
调用DrawShow设置对话框
if
(axCap .HasFilterPropertyPage (CAPTUREPRO3Lib.FILTERPROPTYPE .FILTERPROP_VIDEO_DEVICE ))
{
axCap .ShowFilterPropertyPage (CAPTUREPRO3Lib.FILTERPROPTYPE .FILTERPROP_VIDEO_DEVICE,
""
);
}
}
怎样录像:首先要设置录像文件,可以通过axCap.StreamFile属性来设置录像文件路径,该属性指的是录像文件的完整路径。然后可以设置Preview = true属性来打开预览。然后调用方法axCap.StartCapture ()来开始录像。停止录像很简单只需要调用函数axCap.EndCapture ()就可以了。可以参考以下代码:
private
void
butStartCap_Click(
object
sender, System.EventArgs e)

...
{
if(saveFile.FileName !="") //如果设置了路径则执行操作 否则报错

...{
if(radCapFarme.Checked ) //执行帧捕获操作

...{
if(!flagCapingFarmes) //如果当前没有执行其它捕获

...{
if(!axCap.Preview ) //打开自动预览

...{
axCap.Visible =true;
axCap.Preview =true;
txtBack.Visible =false;
butCaptureImg.Enabled =true;
butPreview.Text ="停止预览";
}
if(chkAutoSave.Checked )

...{
//如果自动保存为真则设置周期
axCap.Interval =Convert.ToInt32 (txtTime.Text ,10); //先设置自动保存时间
}
axCap.AutoSave =chkAutoSave.Checked; //处理自动保存
axCap.AutoIncrement =chkAutoRename.Checked; //处理自动改文件名
axCap.FrameFile =saveFile.FileName ; //设置保存路径
butStartCap.Text ="停止捕获";
flagCapingFarmes=true; //设置工作进行标志 标志忙
axCap.CaptureFrame (); //开始捕获帧
}
else //如果当前正在进行其它捕获工作

...{
axCap.AutoSave =false; //关自动保存
axCap.Interval =0; //自动保存周期置0
butStartCap.Text ="开始捕获";
flagCapingFarmes=false; //置工作空闲标志
DisConnect(); //断开连接 关闭捕获
}
}
else //执行流捕获

...{
if(!flagCapingStream )

...{
axCap.VideoCompressorIndex =cobVicomp.SelectedIndex ;
axCap.AudioDeviceIndex =comAudioDevice.SelectedIndex ;
axCap.AudioCompressorIndex =comAudioComp.SelectedIndex ;
axCap.StreamFile =saveFile.FileName ;
butStartCap.Text ="停止捕获";
flagCapingStream=true;
if(!axCap.Preview ) //打开自动预览

...{
axCap.Visible =true;
axCap.Preview =true;
txtBack.Visible =false;
butCaptureImg.Enabled =true;
butPreview.Text ="停止预览";
}
try

...{
axCap.StartCapture ();
}
catch

...{
MessageBox.Show ("视频编码器不可用,请重新连接设备");
cobVicomp.Items.Clear ();
butStartCap.Text ="开始捕获";
flagCapingStream=false;
axCap.Preview =false;
mnuDisableLink.Enabled =false;
mnuLink.Enabled =true;
cobColor.Enabled =false;
cobPix.Enabled =false;
cobColor.Text =null;
cobColor.Items.Clear ();
cobPix.Text =null;
cobPix.Items .Clear ();
txtBack.Visible =true;
chkAdvCap.Enabled =false;
butPreview.Enabled =false;
butSet.Enabled =false;
butDeviceSet.Enabled =false;
butVideoFormat.Enabled =false;
butCaptureImg.Enabled =false;
chkData.Enabled =false;
chkTime.Enabled =false;
txtLable.Enabled =false;
butPreview.Text ="开始预览";
butLink.Text ="连接设备";
if(chkAdvCap.Checked )
chkAdvCap.CheckState =CheckState.Unchecked ;
visableControl(false,3);
}
}
else

...{
if(axCap.Preview )

...{
axCap.Preview =false;
axCap.Visible =false;
txtBack.Visible =true;
butCaptureImg.Enabled =false;
butPreview.Text ="开始预览";
}
butStartCap.Text ="开始捕获";
flagCapingStream=false;
axCap.EndCapture ();
}
}
}
else

...{
MessageBox.Show ("请先设置要存储的文件!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
}
}
Pegasus CapturePRO 控件是一个功能非常强大的控件,由于篇幅和时间关系这里就不一一叙述了,该控件所有的属性、方法、事件在它的帮助文档中都有详细的说明,大家在使用的时候可以仔细阅读。我写了一个比较详细的Demo程序,该程序使用了绝大多数功能,下面我将软件的界面和源代码给出,希望对大家有所帮助。

该Demo程序的源代码如下:
using
System;
using
System.Drawing;
using
System.Collections;
using
System.ComponentModel;
using
System.Windows.Forms;
using
System.Data;

namespace
CaptureStudio

...
{

/**//// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Capture : System.Windows.Forms.Form

...{
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem mnuLink;
private System.Windows.Forms.MenuItem mnuDisableLink;
private System.Windows.Forms.ComboBox cobColor;
private System.Windows.Forms.ComboBox cobPix;
private System.Windows.Forms.ComboBox cobDevice;
private System.Windows.Forms.Button butPreview;
private Size m_size=new Size (176,144);
private Image capImage;
private bool flagCapingFarmes=false;
private bool flagCapingStream=false;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button butSet;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button butCaptureImg;
private System.Windows.Forms.Button butEditImg;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtBack;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.PictureBox picDis;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.MenuItem mnuClose;
private System.Windows.Forms.MenuItem mnuAdvanceSet;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem mnuMain;
private System.Windows.Forms.MenuItem mnuReg;
private System.Windows.Forms.MenuItem mnuAbout;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox chkData;
private System.Windows.Forms.CheckBox chkTime;
private System.Windows.Forms.TextBox txtLable;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Button butLink;
private System.Windows.Forms.Button butDeviceSet;
private System.Windows.Forms.Button butVideoFormat;
private System.Windows.Forms.CheckBox chkAdvCap;
private System.Windows.Forms.RadioButton radCapFarme;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.RadioButton radCapStream;
private System.Windows.Forms.SaveFileDialog saveFile;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button butSaveFile;
private System.Windows.Forms.TextBox txtPath;
private System.Windows.Forms.Button butStartCap;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.CheckBox chkAutoSave;
private System.Windows.Forms.CheckBox chkAutoRename;
private System.Windows.Forms.CheckBox chkExtJpg;
private System.Windows.Forms.HScrollBar sclChrom;
private System.Windows.Forms.TextBox txtTime;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.HScrollBar sclLum;
private System.Windows.Forms.Label labl7;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox txtChrom;
private System.Windows.Forms.GroupBox groupBox7;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.ComboBox cobVicomp;
private System.Windows.Forms.Button butVideoComp;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Button butAudioDevice;
private System.Windows.Forms.ComboBox comAudioDevice;
private System.Windows.Forms.ComboBox comAudioComp;
private System.Windows.Forms.TextBox txtLum;
private System.Windows.Forms.Button butSaveFrame;
private System.Windows.Forms.Timer timStreamStatus;
private System.Windows.Forms.GroupBox groupBox8;
private AxCAPTUREPRO3Lib.AxCapturePRO axCap;
private System.ComponentModel.IContainer components;
public Capture()

...{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
visableControl(false,3);
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
//判断有没用可用的捕获设备
if(axCap .NumDevices <0)

...{
//没有找到可用的视频设备则报错,并退出程序
MessageBox.Show ("没有发现可用的设备!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
cobDevice.Items .Add("未发现可用视频设备");
cobDevice.SelectedIndex =0;
}
else

...{
//找到则枚举所以设备,并初始化设备组合框
try

...{
for(int i=0;i<axCap .NumDevices ;i++)

...{
cobDevice.Items .Add (axCap .ObtainDeviceName (i));
}
cobDevice.SelectedIndex =0; //设置默认设备
}
catch

...{
MessageBox.Show ("初始化设备失败!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
cobDevice.Items .Add("未发现可用视频设备");
cobDevice.SelectedIndex =0;
}
}
}

/**//// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )

...{
if( disposing )

...{
if (components != null)

...{
components.Dispose();
}
}
base.Dispose( disposing );
}

Windows 窗体设计器生成的代码#region Windows 窗体设计器生成的代码

/**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()

...{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Capture));
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.mnuClose = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.mnuLink = new System.Windows.Forms.MenuItem();
this.mnuDisableLink = new System.Windows.Forms.MenuItem();
this.mnuAdvanceSet = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.mnuMain = new System.Windows.Forms.MenuItem();
this.mnuReg = new System.Windows.Forms.MenuItem();
this.mnuAbout = new System.Windows.Forms.MenuItem();
this.cobColor = new System.Windows.Forms.ComboBox();
this.cobPix = new System.Windows.Forms.ComboBox();
this.butPreview = new System.Windows.Forms.Button();
this.cobDevice = new System.Windows.Forms.ComboBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtBack = new System.Windows.Forms.TextBox();
this.butSet = new System.Windows.Forms.Button();
this.axCap = new AxCAPTUREPRO3Lib.AxCapturePRO();
this.picDis = new System.Windows.Forms.PictureBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.butCaptureImg = new System.Windows.Forms.Button();
this.butEditImg = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.groupBox8 = new System.Windows.Forms.GroupBox();
this.chkData = new System.Windows.Forms.CheckBox();
this.txtLable = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.chkTime = new System.Windows.Forms.CheckBox();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.butVideoComp = new System.Windows.Forms.Button();
this.cobVicomp = new System.Windows.Forms.ComboBox();
this.label9 = new System.Windows.Forms.Label();
this.butAudioDevice = new System.Windows.Forms.Button();
this.comAudioComp = new System.Windows.Forms.ComboBox();
this.label11 = new System.Windows.Forms.Label();
this.comAudioDevice = new System.Windows.Forms.ComboBox();
this.label12 = new System.Windows.Forms.Label();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.butSaveFrame = new System.Windows.Forms.Button();
this.txtLum = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.labl7 = new System.Windows.Forms.Label();
this.txtTime = new System.Windows.Forms.TextBox();
this.sclChrom = new System.Windows.Forms.HScrollBar();
this.label6 = new System.Windows.Forms.Label();
this.chkAutoSave = new System.Windows.Forms.CheckBox();
this.sclLum = new System.Windows.Forms.HScrollBar();
this.label8 = new System.Windows.Forms.Label();
this.chkAutoRename = new System.Windows.Forms.CheckBox();
this.chkExtJpg = new System.Windows.Forms.CheckBox();
this.txtChrom = new System.Windows.Forms.TextBox();
this.butStartCap = new System.Windows.Forms.Button();
this.butSaveFile = new System.Windows.Forms.Button();
this.txtPath = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.radCapFarme = new System.Windows.Forms.RadioButton();
this.radCapStream = new System.Windows.Forms.RadioButton();
this.chkAdvCap = new System.Windows.Forms.CheckBox();
this.butLink = new System.Windows.Forms.Button();
this.butDeviceSet = new System.Windows.Forms.Button();
this.butVideoFormat = new System.Windows.Forms.Button();
this.saveFile = new System.Windows.Forms.SaveFileDialog();
this.timStreamStatus = new System.Windows.Forms.Timer(this.components);
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.axCap)).BeginInit();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox7.SuspendLayout();
this.groupBox6.SuspendLayout();
this.groupBox5.SuspendLayout();
this.SuspendLayout();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[]

...{
this.menuItem1,
this.menuItem2,
this.menuItem3
}
);
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[]

...{
this.mnuClose
}
);
this.menuItem1.Text = "文件(&F)";
//
// mnuClose
//
this.mnuClose.Index = 0;
this.mnuClose.Text = "退出(&X)";
this.mnuClose.Click += new System.EventHandler(this.mnuClose_Click);
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[]

...{
this.mnuLink,
this.mnuDisableLink,
this.mnuAdvanceSet
}
);
this.menuItem2.Text = "控制(&C)";
//
// mnuLink
//
this.mnuLink.Index = 0;
this.mnuLink.Text = "连接设备(&L)";
this.mnuLink.Click += new System.EventHandler(this.mnuLink_Click);
//
// mnuDisableLink
//
this.mnuDisableLink.Enabled = false;
this.mnuDisableLink.Index = 1;
this.mnuDisableLink.Text = "断开连接(&D)";
this.mnuDisableLink.Click += new System.EventHandler(this.mnuDisableLink_Click);
//
// mnuAdvanceSet
//
this.mnuAdvanceSet.Index = 2;
this.mnuAdvanceSet.Text = "高级设置(&A)";
//
// menuItem3
//
this.menuItem3.Index = 2;
this.menuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[]

...{
this.mnuMain,
this.mnuReg,
this.mnuAbout
}
);
this.menuItem3.Text = "帮助(&H)";
//
// mnuMain
//
this.mnuMain.Index = 0;
this.mnuMain.Text = "主题(&M)";
//
// mnuReg
//
this.mnuReg.Index = 1;
this.mnuReg.Text = "注册(&R)";
//
// mnuAbout
//
this.mnuAbout.Index = 2;
this.mnuAbout.Text = "关于(&A)";
//
// cobColor
//
this.cobColor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cobColor.Enabled = false;
this.cobColor.Location = new System.Drawing.Point(88, 40);
this.cobColor.Name = "cobColor";
this.cobColor.Size = new System.Drawing.Size(120, 20);
this.cobColor.TabIndex = 1;
this.cobColor.SelectedIndexChanged += new System.EventHandler(this.cobColor_SelectedIndexChanged);
//
// cobPix
//
this.cobPix.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cobPix.Enabled = false;
this.cobPix.Location = new System.Drawing.Point(280, 40);
this.cobPix.Name = "cobPix";
this.cobPix.Size = new System.Drawing.Size(168, 20);
this.cobPix.TabIndex = 2;
this.cobPix.SelectedIndexChanged += new System.EventHandler(this.cobPix_SelectedIndexChanged);
//
// butPreview
//
this.butPreview.Enabled = false;
this.butPreview.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.butPreview.Location = new System.Drawing.Point(8, 168);
this.butPreview.Name = "butPreview";
this.butPreview.Size = new System.Drawing.Size(72, 24);
this.butPreview.TabIndex = 3;
this.butPreview.Text = "开始预览";
this.butPreview.Click += new System.EventHandler(this.butPreview_Click);
//
// cobDevice
//
this.cobDevice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cobDevice.Location = new System.Drawing.Point(88, 12);
this.cobDevice.Name = "cobDevice";
this.cobDevice.Size = new System.Drawing.Size(360, 20);
this.cobDevice.TabIndex = 4;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.txtBack);
this.groupBox1.Controls.Add(this.butPreview);
this.groupBox1.Controls.Add(this.butSet);
this.groupBox1.Controls.Add(this.axCap);
this.groupBox1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(8, 112);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(192, 200);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "预览视频(176X144)";
//
// txtBack
//
this.txtBack.BackColor = System.Drawing.Color.Navy;
this.txtBack.CausesValidation = false;
this.txtBack.Enabled = false;
this.txtBack.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.txtBack.Location = new System.Drawing.Point(8, 16);
this.txtBack.Multiline = true;
this.txtBack.Name = "txtBack";
this.txtBack.Size = new System.Drawing.Size(176, 144);
this.txtBack.TabIndex = 9;
this.txtBack.Text = " 等待预览...";
this.txtBack.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// butSet
//
this.butSet.Enabled = false;
this.butSet.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.butSet.Location = new System.Drawing.Point(112, 168);
this.butSet.Name = "butSet";
this.butSet.Size = new System.Drawing.Size(72, 24);
this.butSet.TabIndex = 3;
this.butSet.Text = "调整效果";
this.butSet.Click += new System.EventHandler(this.butSet_Click);
//
// axCap
//
this.axCap.ContainingControl = this;
this.axCap.Location = new System.Drawing.Point(8, 16);
this.axCap.Name = "axCap";
this.axCap.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axCap.OcxState")));
this.axCap.Size = new System.Drawing.Size(176, 144);
this.axCap.TabIndex = 10;
//
// picDis
//
this.picDis.Image = ((System.Drawing.Image)(resources.GetObject("picDis.Image")));
this.picDis.Location = new System.Drawing.Point(8, 16);
this.picDis.Name = "picDis";
this.picDis.Size = new System.Drawing.Size(176, 144);
this.picDis.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picDis.TabIndex = 6;
this.picDis.TabStop = false;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.picDis);
this.groupBox2.Controls.Add(this.butCaptureImg);
this.groupBox2.Controls.Add(this.butEditImg);
this.groupBox2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.groupBox2.Location = new System.Drawing.Point(8, 320);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(192, 200);
this.groupBox2.TabIndex = 7;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "图片捕获(预览:176X144)";
//
// butCaptureImg
//
this.butCaptureImg.Enabled = false;
this.butCaptureImg.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.butCaptureImg.Location = new System.Drawing.Point(8, 168);
this.butCaptureImg.Name = "butCaptureImg";
this.butCaptureImg.Size = new System.Drawing.Size(72, 24);
this.butCaptureImg.TabIndex = 3;
this.butCaptureImg.Text = "截取图片";
this.butCaptureImg.Click += new System.EventHandler(this.butCaptureImg_Click);
//
// butEditImg
//
this.butEditImg.Enabled = false;
this.butEditImg.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.butEditImg.Location = new System.Drawing.Point(112, 168);
this.butEditImg.Name = "butEditImg";
this.butEditImg.Size = new System.Drawing.Size(72, 24);
this.butEditImg.TabIndex = 3;
this.butEditImg.Text = "编辑图片";
//
// label1
//
this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.label1.Location = new System.Drawing.Point(8, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 24);
this.label1.TabIndex = 8;
this.label1.Text = "视频设备:";
this.label1.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// label2
//
this.label2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.label2.Location = new System.Drawing.Point(8, 40);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 24);
this.label2.TabIndex = 8;
this.label2.Text = "色彩选择:";
this.label2.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// label3
//
this.label3.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold);
this.label3.Location = new System.Drawing.Point(216, 40);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(72, 24);
this.label3.TabIndex = 8;
this.label3.Text = "分辨率:";
this.label3.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.groupBox8);
this.groupBox3.Controls.Add(this.chkData);
this.groupBox3.Controls.Add(this.txtLable);
this.groupBox3.Controls.Add(this.label4);
this.groupBox3.Controls.Add(this.chkTime);
this.groupBox3.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.groupBox3.Location = new System.Drawing.Point(8, 64);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(440, 48);
this.groupBox3.TabIndex = 9;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "添加标题";
//
// groupBox8
//
this.groupBox8.Location = new System.Drawing.Point(32, 19);
this.groupBox8.Name = "groupBox8";
this.groupBox8.Size = new System.Drawing.Size(8, 8);
this.groupBox8.TabIndex = 13;
this.groupBox8.TabStop = false;
this.groupBox8.Text = "groupBox8";
//
// chkData
//
this.chkData.Enabled = false;
this.chkData.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.chkData.Location = new System.Drawing.Point(8, 16);
this.chkData.Name = "chkData";
this.chkData.Size = new System.Drawing.Size(80, 24);
this.chkData.TabIndex = 10;
this.chkData.Text = "添加日期";
this.chkData.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.chkData.CheckedChanged += new System.EventHandler(this.chkData_CheckedChanged);
//
// txtLable
//
this.txtLable.AutoSize = false;
this.txtLable.Enabled = false;
this.txtLable.Location = new System.Drawing.Point(240, 17);
this.txtLable.MaxLength = 15;
this.txtLable.Name = "txtLable";
this.txtLable.Size = new System.Drawing.Size(192, 23);
this.txtLable.TabIndex = 11;
this.txtLable.Text = "";
this.txtLable.TextChanged += new System.EventHandler(this.txtLable_TextChanged);
//
// label4
//
this.label4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label4.Location = new System.Drawing.Point(160, 24);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(80, 16);
this.label4.TabIndex = 12;
this.label4.Text = "自定义标题:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// chkTime
//
this.chkTime.Enabled = false;
this.chkTime.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.chkTime.Location = new System.Drawing.Point(88, 16);
this.chkTime.Name = "chkTime";
this.chkTime.Size = new System.Drawing.Size(80, 24);
this.chkTime.TabIndex = 10;
this.chkTime.Text = "添加时间";
this.chkTime.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.chkTime.CheckedChanged += new System.EventHandler(this.chkTime_CheckedChanged);
//
// groupBox4
//
this.groupBox4.Controls.Add(this.groupBox7);
this.groupBox4.Controls.Add(this.groupBox6);
this.groupBox4.Controls.Add(this.butStartCap);
this.groupBox4.Controls.Add(this.butSaveFile);
this.groupBox4.Controls.Add(this.txtPath);
this.groupBox4.Controls.Add(this.label5);
this.groupBox4.Controls.Add(this.groupBox5);
this.groupBox4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.groupBox4.Location = new System.Drawing.Point(216, 112);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(368, 408);
this.groupBox4.TabIndex = 10;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "高级捕获";
//
// groupBox7
//
this.groupBox7.Controls.Add(this.butVideoComp);
this.groupBox7.Controls.Add(this.cobVicomp);
this.groupBox7.Controls.Add(this.label9);
this.groupBox7.Controls.Add(this.butAudioDevice);
this.groupBox7.Controls.Add(this.comAudioComp);
this.groupBox7.Controls.Add(this.label11);
this.groupBox7.Controls.Add(this.comAudioDevice);
this.groupBox7.Controls.Add(this.label12);
this.groupBox7.Location = new System.Drawing.Point(8, 208);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(352, 112);
this.groupBox7.TabIndex = 8;
this.groupBox7.TabStop = false;
this.groupBox7.Text = "流捕获";
//
// butVideoComp
//
this.butVideoComp.Location = new System.Drawing.Point(272, 16);
this.butVideoComp.Name = "butVideoComp";
this.butVideoComp.Size = new System.Drawing.Size(72, 24);
this.butVideoComp.TabIndex = 3;
this.butVideoComp.Text = "配置编码";
this.butVideoComp.Click += new System.EventHandler(this.butVideoComp_Click);
//
// cobVicomp
//
this.cobVicomp.Location = new System.Drawing.Point(72, 20);
this.cobVicomp.Name = "cobVicomp";
this.cobVicomp.Size = new System.Drawing.Size(192, 20);
this.cobVicomp.TabIndex = 2;
this.cobVicomp.SelectedIndexChanged += new System.EventHandler(this.cobVicomp_SelectedIndexChanged);
//
// label9
//
this.label9.Location = new System.Drawing.Point(8, 25);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(64, 16);
this.label9.TabIndex = 1;
this.label9.Text = "视频编码: ";
this.label9.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// butAudioDevice
//
this.butAudioDevice.Location = new System.Drawing.Point(272, 48);
this.butAudioDevice.Name = "butAudioDevice";
this.butAudioDevice.Size = new System.Drawing.Size(72, 24);
this.butAudioDevice.TabIndex = 3;
this.butAudioDevice.Text = "配置设备";
this.butAudioDevice.Click += new System.EventHandler(this.butAudioDevice_Click);
//
// comAudioComp
//
this.comAudioComp.Location = new System.Drawing.Point(72, 80);
this.comAudioComp.Name = "comAudioComp";
this.comAudioComp.Size = new System.Drawing.Size(192, 20);
this.comAudioComp.TabIndex = 2;
this.comAudioComp.SelectedIndexChanged += new System.EventHandler(this.comAudioComp_SelectedIndexChanged);
//
// label11
//
this.label11.Location = new System.Drawing.Point(8, 53);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(64, 16);
this.label11.TabIndex = 1;
this.label11.Text = "音频设备: ";
this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// comAudioDevice
//
this.comAudioDevice.Location = new System.Drawing.Point(72, 50);
this.comAudioDevice.Name = "comAudioDevice";
this.comAudioDevice.Size = new System.Drawing.Size(192, 20);
this.comAudioDevice.TabIndex = 2;
this.comAudioDevice.SelectedIndexChanged += new System.EventHandler(this.comAudioDevice_SelectedIndexChanged);
//
// label12
//
this.label12.Location = new System.Drawing.Point(8, 84);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(64, 16);
this.label12.TabIndex = 1;
this.label12.Text = "音频编码: ";
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// groupBox6
//
this.groupBox6.Controls.Add(this.butSaveFrame);
this.groupBox6.Controls.Add(this.txtLum);
this.groupBox6.Controls.Add(this.label7);
this.groupBox6.Controls.Add(this.labl7);
this.groupBox6.Controls.Add(this.txtTime);
this.groupBox6.Controls.Add(this.sclChrom);
this.groupBox6.Controls.Add(this.label6);
this.groupBox6.Controls.Add(this.chkAutoSave);
this.groupBox6.Controls.Add(this.sclLum);
this.groupBox6.Controls.Add(this.label8);
this.groupBox6.Controls.Add(this.chkAutoRename);
this.groupBox6.Controls.Add(this.chkExtJpg);
this.groupBox6.Controls.Add(this.txtChrom);
this.groupBox6.Location = new System.Drawing.Point(8, 96);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(352, 112);
this.groupBox6.TabIndex = 7;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "帧捕获";
//
// butSaveFrame
//
this.butSaveFrame.Location = new System.Drawing.Point(280, 13);
this.butSaveFrame.Name = "butSaveFrame";
this.butSaveFrame.Size = new System.Drawing.Size(64, 24);
this.butSaveFrame.TabIndex = 14;
this.butSaveFrame.Text = "保存帧";
this.butSaveFrame.Click += new System.EventHandler(this.butSaveFrame_Click);
//
// txtLum
//
this.txtLum.Location = new System.Drawing.Point(224, 51);
this.txtLum.MaxLength = 3;
this.txtLum.Name = "txtLum";
this.txtLum.Size = new System.Drawing.Size(32, 21);
this.txtLum.TabIndex = 13;
this.txtLum.Text = "30";
this.txtLum.TextChanged += new System.EventHandler(this.txtLum_TextChanged);
//
// label7
//
this.label7.Location = new System.Drawing.Point(160, 80);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(56, 24);
this.label7.TabIndex = 12;
this.label7.Text = "Jpg色度:";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// labl7
//
this.labl7.Location = new System.Drawing.Point(240, 24);
this.labl7.Name = "labl7";
this.labl7.Size = new System.Drawing.Size(32, 16);
this.labl7.TabIndex = 11;
this.labl7.Text = "秒";
this.labl7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtTime
//
this.txtTime.Location = new System.Drawing.Point(160, 16);
this.txtTime.Name = "txtTime";
this.txtTime.Size = new System.Drawing.Size(72, 21);
this.txtTime.TabIndex = 9;
this.txtTime.Text = "10";
this.txtTime.TextChanged += new System.EventHandler(this.txtTime_TextChanged);
//
// sclChrom
//
this.sclChrom.LargeChange = 5;
this.sclChrom.Location = new System.Drawing.Point(264, 80);
this.sclChrom.Maximum = 255;
this.sclChrom.Name = "sclChrom";
this.sclChrom.Size = new System.Drawing.Size(80, 24);
this.sclChrom.TabIndex = 8;
this.sclChrom.Value = 36;
this.sclChrom.ValueChanged += new System.EventHandler(this.sclChrom_ValueChanged);
//
// label6
//
this.label6.Location = new System.Drawing.Point(96, 16);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(64, 24);
this.label6.TabIndex = 10;
this.label6.Text = "时间间隔: ";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// chkAutoSave
//
this.chkAutoSave.Location = new System.Drawing.Point(16, 16);
this.chkAutoSave.Name = "chkAutoSave";
this.chkAutoSave.Size = new System.Drawing.Size(80, 24);
this.chkAutoSave.TabIndex = 0;
this.chkAutoSave.Text = "自动保存";
this.chkAutoSave.CheckedChanged += new System.EventHandler(this.chkAutoSave_CheckedChanged);
//
// sclLum
//
this.sclLum.LargeChange = 5;
this.sclLum.Location = new System.Drawing.Point(264, 48);
this.sclLum.Maximum = 255;
this.sclLum.Name = "sclLum";
this.sclLum.Size = new System.Drawing.Size(80, 24);
this.sclLum.TabIndex = 8;
this.sclLum.Value = 30;
this.sclLum.ValueChanged += new System.EventHandler(this.sclLum_ValueChanged);
//
// label8
//
this.label8.Location = new System.Drawing.Point(160, 48);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(56, 24);
this.label8.TabIndex = 12;
this.label8.Text = "Jpg亮度:";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// chkAutoRename
//
this.chkAutoRename.Location = new System.Drawing.Point(16, 48);
this.chkAutoRename.Name = "chkAutoRename";
this.chkAutoRename.Size = new System.Drawing.Size(80, 24);
this.chkAutoRename.TabIndex = 0;
this.chkAutoRename.Text = "自动命名";
this.chkAutoRename.CheckedChanged += new System.EventHandler(this.chkAutoRename_CheckedChanged);
//
// chkExtJpg
//
this.chkExtJpg.Location = new System.Drawing.Point(16, 80);
this.chkExtJpg.Name = "chkExtJpg";
this.chkExtJpg.Size = new System.Drawing.Size(80, 24);
this.chkExtJpg.TabIndex = 0;
this.chkExtJpg.Text = "扩展Jpg";
this.chkExtJpg.CheckedChanged += new System.EventHandler(this.chkExtJpg_CheckedChanged);
//
// txtChrom
//
this.txtChrom.Location = new System.Drawing.Point(224, 83);
this.txtChrom.MaxLength = 3;
this.txtChrom.Name = "txtChrom";
this.txtChrom.Size = new System.Drawing.Size(32, 21);
this.txtChrom.TabIndex = 13;
this.txtChrom.Text = "36";
this.txtChrom.TextChanged += new System.EventHandler(this.txtChrom_TextChanged);
//
// butStartCap
//
this.butStartCap.Location = new System.Drawing.Point(288, 32);
this.butStartCap.Name = "butStartCap";
this.butStartCap.Size = new System.Drawing.Size(64, 24);
this.butStartCap.TabIndex = 6;
this.butStartCap.Text = "开始捕获";
this.butStartCap.Click += new System.EventHandler(this.butStartCap_Click);
//
// butSaveFile
//
this.butSaveFile.Image = ((System.Drawing.Image)(resources.GetObject("butSaveFile.Image")));
this.butSaveFile.Location = new System.Drawing.Point(327, 64);
this.butSaveFile.Name = "butSaveFile";
this.butSaveFile.Size = new System.Drawing.Size(25, 21);
this.butSaveFile.TabIndex = 5;
this.butSaveFile.TabStop = false;
this.butSaveFile.Click += new System.EventHandler(this.butSaveFile_Click);
//
// txtPath
//
this.txtPath.Location = new System.Drawing.Point(72, 64);
this.txtPath.Name = "txtPath";
this.txtPath.Size = new System.Drawing.Size(240, 21);
this.txtPath.TabIndex = 3;
this.txtPath.Text = "";
//
// label5
//
this.label5.Location = new System.Drawing.Point(16, 64);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(64, 24);
this.label5.TabIndex = 4;
this.label5.Text = "保存文件:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// groupBox5
//
this.groupBox5.Controls.Add(this.radCapFarme);
this.groupBox5.Controls.Add(this.radCapStream);
this.groupBox5.Controls.Add(this.chkAdvCap);
this.groupBox5.Location = new System.Drawing.Point(8, 16);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(352, 80);
this.groupBox5.TabIndex = 2;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "控制选项";
//
// radCapFarme
//
this.radCapFarme.Checked = true;
this.radCapFarme.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.radCapFarme.Location = new System.Drawing.Point(120, 16);
this.radCapFarme.Name = "radCapFarme";
this.radCapFarme.Size = new System.Drawing.Size(64, 24);
this.radCapFarme.TabIndex = 1;
this.radCapFarme.TabStop = true;
this.radCapFarme.Text = "捕获帧";
this.radCapFarme.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.radCapFarme.CheckedChanged += new System.EventHandler(this.radCapFarme_CheckedChanged);
//
// radCapStream
//
this.radCapStream.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.radCapStream.Location = new System.Drawing.Point(200, 16);
this.radCapStream.Name = "radCapStream";
this.radCapStream.Size = new System.Drawing.Size(64, 24);
this.radCapStream.TabIndex = 1;
this.radCapStream.Text = "捕获流";
this.radCapStream.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.radCapStream.CheckedChanged += new System.EventHandler(this.radCapStream_CheckedChanged);
//
// chkAdvCap
//
this.chkAdvCap.Enabled = false;
this.chkAdvCap.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.chkAdvCap.Location = new System.Drawing.Point(8, 16);
this.chkAdvCap.Name = "chkAdvCap";
this.chkAdvCap.Size = new System.Drawing.Size(112, 24);
this.chkAdvCap.TabIndex = 0;
this.chkAdvCap.Text = "开启高级捕获";
this.chkAdvCap.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.chkAdvCap.CheckedChanged += new System.EventHandler(this.chkAdvCap_CheckedChanged);
//
// butLink
//
this.butLink.Location = new System.Drawing.Point(472, 8);
this.butLink.Name = "butLink";
this.butLink.Size = new System.Drawing.Size(88, 24);
this.butLink.TabIndex = 11;
this.butLink.Text = "连接设备";
this.butLink.Click += new System.EventHandler(this.butLink_Click);
//
// butDeviceSet
//
this.butDeviceSet.Enabled = false;
this.butDeviceSet.Location = new System.Drawing.Point(472, 48);
this.butDeviceSet.Name = "butDeviceSet";
this.butDeviceSet.Size = new System.Drawing.Size(88, 24);
this.butDeviceSet.TabIndex = 11;
this.butDeviceSet.Text = "设备设置";
this.butDeviceSet.Click += new System.EventHandler(this.butDeviceSet_Click);
//
// butVideoFormat
//
this.butVideoFormat.Enabled = false;
this.butVideoFormat.Location = new System.Drawing.Point(472, 88);
this.butVideoFormat.Name = "butVideoFormat";
this.butVideoFormat.Size = new System.Drawing.Size(88, 24);
this.butVideoFormat.TabIndex = 11;
this.butVideoFormat.Text = "视频控制";
this.butVideoFormat.Click += new System.EventHandler(this.butVideoFormat_Click);
//
// timStreamStatus
//
this.timStreamStatus.Interval = 1000;
//
// Capture
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.CausesValidation = false;
this.ClientSize = new System.Drawing.Size(600, 537);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.label1);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.cobDevice);
this.Controls.Add(this.cobPix);
this.Controls.Add(this.cobColor);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label3);
this.Controls.Add(this.butVideoFormat);
this.Controls.Add(this.butLink);
this.Controls.Add(this.butDeviceSet);
this.Menu = this.mainMenu1;
this.Name = "Capture";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "视频捕获器";
this.Load += new System.EventHandler(this.Capture_Load);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.axCap)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.groupBox7.ResumeLayout(false);
this.groupBox6.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion

/**//// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()

...{
Application.Run(new Capture());
}
private void mnuLink_Click(object sender, System.EventArgs e)

...{
//连接设备
ConnectDevice();
}
private void mnuDisableLink_Click(object sender, System.EventArgs e)

...{
DisConnect();
}
private void cobColor_SelectedIndexChanged(object sender, System.EventArgs e)

...{
//更改颜色
if(axCap.IsConnected )

...{
axCap.VideoColorFormatIndex =cobColor.SelectedIndex ;
axCap.Size =m_size;
}
}
private void cobPix_SelectedIndexChanged(object sender, System.EventArgs e)

...{
//更改分辨率
if(axCap.IsConnected )

...{
axCap.VideoResolutionIndex=cobPix.SelectedIndex ;
axCap.Size =m_size; //限制视频预览窗口大小
}
}
private void butPreview_Click(object sender, System.EventArgs e)

...{
if(!axCap.Preview )

...{
axCap.Visible =true;
axCap.Preview =true;
txtBack.Visible =false;
butCaptureImg.Enabled =true;
butPreview.Text ="停止预览";
}
else

...{
axCap.Preview =false;
axCap.Visible =false;
txtBack.Visible =true;
butCaptureImg.Enabled =false;
butPreview.Text ="开始预览";
}
}
private void butSet_Click(object sender, System.EventArgs e)

...{
//调用DrawShow设置对话框
if (axCap .HasFilterPropertyPage (CAPTUREPRO3Lib.FILTERPROPTYPE .FILTERPROP_VIDEO_DEVICE ))

...{
axCap .ShowFilterPropertyPage (CAPTUREPRO3Lib.FILTERPROPTYPE .FILTERPROP_VIDEO_DEVICE, "");
}
}
private void butCaptureImg_Click(object sender, System.EventArgs e)

...{
//捕获图片按钮
if(!butEditImg.Enabled ) //如果编辑按钮无效则置有效
butEditImg.Enabled =true;
axCap.CaptureFrame (); //帧捕获模式
capImage=axCap.Picture ; //显示最后一次捕获的帧
picDis.Image =capImage;
}
private void mnuClose_Click(object sender, System.EventArgs e)

...{
//文件-->退出
Application.Exit();//退出系统
}
private void chkData_CheckedChanged(object sender, System.EventArgs e)

...{
if(txtLable.Text =="")

...{
if(chkTime.CheckState==CheckState.Checked && chkData.CheckState==CheckState.Checked)

...{
axCap.HAlign =CAPTUREPRO3Lib.HALIGNTYPE.HAlignCenter ;
axCap.VAlign =CAPTUREPRO3Lib.VALIGNTYPE.VAlignBottom ;
axCap.Caption ="%d"+" "+"%t";
}
else

...{
if(chkTime.CheckState ==CheckState.Checked )

...{
axCap.HAlign =CAPTUREPRO3Lib.HALIGNTYPE.HAlignRight ;
axCap.VAlign =CAPTUREPRO3Lib.VALIGNTYPE.VAlignBottom ;
axCap.Caption ="%t";
}
else if(chkData.CheckState ==CheckState.Checked )

...{
axCap.HAlign =CAPTUREPRO3Lib.HALIGNTYPE.HAlignLeft ;
axCap.VAlign =CAPTUREPRO3Lib.VALIGNTYPE.VAlignTop ;
axCap.Caption ="%d";
}
else
axCap.Caption ="";
}
}
else

...{
chkTime.CheckState =CheckState.Unchecked ;
chkData.CheckState =CheckState.Unchecked ;
axCap.HAlign =CAPTUREPRO3Lib.HALIGNTYPE.HAlignCenter ;
axCap.VAlign =CAPTUREPRO3Lib.VALIGNTYPE.VAlignTop ;
axCap.Caption =txtLable.Text ;
}
}
private void chkTime_CheckedChanged(object sender, System.EventArgs e)

...{
//处理时间及日期标题
if(txtLable.Text =="") //如果文本框中没有输入则有效 否则日期,时间选择无效

...{
//时间与日期都选中
if(chkTime.CheckState==CheckState.Checked && chkData.CheckState==CheckState.Checked)

...{
//在底部居中显示日期和时间
axCap.HAlign =CAPTUREPRO3Lib.HALIGNTYPE.HAlignCenter ;
axCap.VAlign =CAPTUREPRO3Lib.VALIGNTYPE.VAlignBottom ;
axCap.Caption ="%d"+" "+"%t";
}
else

...{
//时间选中
if(chkTime.CheckState ==CheckState.Checked )

...{
//底部靠右显示时间
axCap.HAlign =CAPTUREPRO3Lib.HALIGNTYPE.HAlignRight ;
axCap.VAlign =CAPTUREPRO3Lib.VALIGNTYPE.VAlignBottom ;
axCap.Caption ="%t";
}
//日期选中
else if(chkData.CheckState ==CheckState.Checked )

...{
//顶部靠左显示日期
axCap.HAlign =CAPTUREPRO3Lib.HALIGNTYPE.HAlignLeft ;
axCap.VAlign =CAPTUREPRO3Lib.VALIGNTYPE.VAlignTop ;
axCap.Caption ="%d";
}
else //都未选中则不显示标题
axCap.Caption ="";
}
}
else //文本框中有输入则显示输入的标题

...{
chkTime.CheckState =CheckState.Unchecked ; //置时间,日期选择无效
chkData.CheckState =CheckState.Unchecked ;
//顶部居中显示输入标题
axCap.HAlign =CAPTUREPRO3Lib.HALIGNTYPE.HAlignCenter ;
axCap.VAlign =CAPTUREPRO3Lib.VALIGNTYPE.VAlignTop ;
axCap.Caption =txtLable.Text ;
}
}
private void txtLable_TextChanged(object sender, System.EventArgs e)

...{
//提取文本框中输入的标题 最大字符数: 15
//在预览视频的顶部居中显示输入的标题
chkTime.CheckState =CheckState.Unchecked ; //置日期,时间选择无效
chkData.CheckState =CheckState.Unchecked ;
if(txtLable.Text .Length >=15) //提示输入已达最大长度

...{
MessageBox.Show ("已达最大允许输入字符数!","提示!",MessageBoxButtons.OK ,MessageBoxIcon.Information );
}
axCap.HAlign =CAPTUREPRO3Lib.HALIGNTYPE.HAlignCenter ; //居中显示
axCap.VAlign =CAPTUREPRO3Lib.VALIGNTYPE.VAlignTop ; //顶部显示
axCap.Caption =txtLable.Text ;
}
private void Capture_Load(object sender, System.EventArgs e)

...{
}
private void butDeviceSet_Click(object sender, System.EventArgs e)

...{
if(axCap.IsConnected )
axCap.ShowVideoSourceDlg() ;
else
MessageBox.Show ("设备连接也断开,请重新连接设备!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
if(axCap.AudioDeviceIndex !=-1 && chkAdvCap.CheckState ==CheckState.Checked &&
radCapStream.Checked)
comAudioDevice.SelectedIndex =axCap.AudioDeviceIndex ;
}
private void butVideoFormat_Click(object sender, System.EventArgs e)

...{
if(axCap.IsConnected )
axCap.ShowVideoFormatDlg ();
else
MessageBox.Show ("设备连接也断开,请重新连接设备!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
}
private void butLink_Click(object sender, System.EventArgs e)

...{
if(!axCap.IsConnected )

...{
//连接设备
ConnectDevice();
}
else

...{
//断开连接
DisConnect();
}
}
private void butSaveFile_Click(object sender, System.EventArgs e)

...{
saveFile.RestoreDirectory =true;
if(radCapStream.Checked )

...{
saveFile.Filter ="视频文件(*.avi)|*.avi|所有文件(*.*)|*.*";
}
else

...{
saveFile.Filter ="位图文件(*.bmp)|*.bmp|JPEG文件(*.jpg;*.jpeg)|*.jpg;*.jpeg|所有文件(*.*)|*.*";
}
if(saveFile.ShowDialog ()==DialogResult.OK )

...{
txtPath.Text =saveFile.FileName ;
}
}
private void chkAdvCap_CheckedChanged(object sender, System.EventArgs e)

...{
bool ConEnable=true;
if(chkAdvCap.CheckState ==CheckState.Checked )

...{
//控制模块中各控件的Enable属性
radCapFarme.Enabled =ConEnable;
radCapStream.Enabled=ConEnable;
txtPath.Enabled=ConEnable;
butSaveFile.Enabled=ConEnable;
if(axCap.IsConnected )
butStartCap.Enabled=ConEnable;
else
butStartCap.Enabled =!ConEnable;
radCapFarme.Enabled=ConEnable;
radCapStream.Enabled=ConEnable;
//判断当前选中的捕获模块
if(radCapFarme.Checked)
visableControl(ConEnable,1);
else
visableControl(ConEnable,2);
}
else

...{
ConEnable=false;
visableControl(ConEnable,3); //禁用所有模块
}
}

/**//// <summary>
/// 显示/隐藏控件
/// </summary>
public void visableControl(bool ConEnable,int ModolType)

...{
//ModolType=1 选中帧捕获模式
if(ModolType==1)

...{
//帧捕获模块中各控件的Enable属性
chkAutoSave.Enabled=ConEnable;
chkAutoRename.Enabled=ConEnable;
chkExtJpg.Enabled=ConEnable;
if(chkAutoSave.Checked )

...{
butSaveFrame.Enabled =!ConEnable;
txtTime.Enabled=ConEnable;
}
else

...{
butSaveFrame.Enabled =ConEnable;
txtTime.Enabled=!ConEnable;
}
if(chkExtJpg.Checked )

...{
txtChrom.Enabled=ConEnable;
txtLum.Enabled=ConEnable;
sclChrom.Enabled=ConEnable;
sclLum.Enabled=ConEnable;
}
else

...{
txtChrom.Enabled=!ConEnable;
txtLum.Enabled=!ConEnable;
sclChrom.Enabled=!ConEnable;
sclLum.Enabled=!ConEnable;
}
//流捕获模块中各控件的Enable属性
cobVicomp.Enabled=!ConEnable;
comAudioComp.Enabled=!ConEnable;
comAudioDevice.Enabled=!ConEnable;
butVideoComp.Enabled=!ConEnable;
butAudioDevice.Enabled=!ConEnable;
}
//ModolType=2 选中流捕获模式
else if(ModolType==2)

...{
//帧捕获模块中各控件的Enable属性
chkAutoSave.Enabled=!ConEnable;
chkAutoRename.Enabled=!ConEnable;
chkExtJpg.Enabled=!ConEnable;
txtTime.Enabled=!ConEnable;
txtChrom.Enabled=!ConEnable;
txtLum.Enabled=!ConEnable;
sclChrom.Enabled=!ConEnable;
sclLum.Enabled=!ConEnable;
butSaveFrame.Enabled =!ConEnable;
//流捕获模块中各控件的Enable属性
cobVicomp.Enabled=ConEnable;
comAudioComp.Enabled=ConEnable;
comAudioDevice.Enabled=ConEnable;
butVideoComp.Enabled=ConEnable;
butAudioDevice.Enabled=ConEnable;
GetSystemInfo();
}
//ModolType=3 关闭高级捕获
else

...{
//控制模块中各控件的Enable属性
radCapFarme.Enabled =ConEnable;
radCapStream.Enabled=ConEnable;
txtPath.Enabled=ConEnable;
butSaveFile.Enabled=ConEnable;
butStartCap.Enabled=ConEnable;
radCapFarme.Enabled=ConEnable;
radCapStream.Enabled=ConEnable;
//帧捕获模块中各控件的Enable属性
chkAutoSave.Enabled=ConEnable;
chkAutoRename.Enabled=ConEnable;
chkExtJpg.Enabled=ConEnable;
txtTime.Enabled=ConEnable;
txtChrom.Enabled=ConEnable;
txtLum.Enabled=ConEnable;
sclChrom.Enabled=ConEnable;
sclLum.Enabled=ConEnable;
butSaveFrame.Enabled =ConEnable;
//流捕获模块中各控件的Enable属性
cobVicomp.Enabled=ConEnable;
comAudioComp.Enabled=ConEnable;
comAudioDevice.Enabled=ConEnable;
butVideoComp.Enabled=ConEnable;
butAudioDevice.Enabled=ConEnable;
}
}
private void radCapFarme_CheckedChanged(object sender, System.EventArgs e)

...{
//选中帧捕获模块 禁用流捕获模块
if(radCapFarme.Checked )
visableControl(true,1);
}
private void radCapStream_CheckedChanged(object sender, System.EventArgs e)

...{
//选中流捕获模块 禁用帧捕获模块
if(radCapStream.Checked )

...{
visableControl(true,2);
}
}
private void butStartCap_Click(object sender, System.EventArgs e)

...{
if(saveFile.FileName !="") //如果设置了路径则执行操作 否则报错

...{
if(radCapFarme.Checked ) //执行帧捕获操作

...{
if(!flagCapingFarmes) //如果当前没有执行其它捕获

...{
if(!axCap.Preview ) //打开自动预览

...{
axCap.Visible =true;
axCap.Preview =true;
txtBack.Visible =false;
butCaptureImg.Enabled =true;
butPreview.Text ="停止预览";
}
if(chkAutoSave.Checked )

...{
//如果自动保存为真则设置周期
axCap.Interval =Convert.ToInt32 (txtTime.Text ,10); //先设置自动保存时间
}
axCap.AutoSave =chkAutoSave.Checked; //处理自动保存
axCap.AutoIncrement =chkAutoRename.Checked; //处理自动改文件名
axCap.FrameFile =saveFile.FileName ; //设置保存路径
butStartCap.Text ="停止捕获";
flagCapingFarmes=true; //设置工作进行标志 标志忙
axCap.CaptureFrame (); //开始捕获帧
}
else //如果当前正在进行其它捕获工作

...{
axCap.AutoSave =false; //关自动保存
axCap.Interval =0; //自动保存周期置0
butStartCap.Text ="开始捕获";
flagCapingFarmes=false; //置工作空闲标志
DisConnect(); //断开连接 关闭捕获
}
}
else //执行流捕获

...{
if(!flagCapingStream )

...{
axCap.VideoCompressorIndex =cobVicomp.SelectedIndex ;
axCap.AudioDeviceIndex =comAudioDevice.SelectedIndex ;
axCap.AudioCompressorIndex =comAudioComp.SelectedIndex ;
axCap.StreamFile =saveFile.FileName ;
butStartCap.Text ="停止捕获";
flagCapingStream=true;
if(!axCap.Preview ) //打开自动预览

...{
axCap.Visible =true;
axCap.Preview =true;
txtBack.Visible =false;
butCaptureImg.Enabled =true;
butPreview.Text ="停止预览";
}
try

...{
axCap.StartCapture ();
}
catch

...{
MessageBox.Show ("视频编码器不可用,请重新连接设备");
cobVicomp.Items.Clear ();
butStartCap.Text ="开始捕获";
flagCapingStream=false;
axCap.Preview =false;
mnuDisableLink.Enabled =false;
mnuLink.Enabled =true;
cobColor.Enabled =false;
cobPix.Enabled =false;
cobColor.Text =null;
cobColor.Items.Clear ();
cobPix.Text =null;
cobPix.Items .Clear ();
txtBack.Visible =true;
chkAdvCap.Enabled =false;
butPreview.Enabled =false;
butSet.Enabled =false;
butDeviceSet.Enabled =false;
butVideoFormat.Enabled =false;
butCaptureImg.Enabled =false;
chkData.Enabled =false;
chkTime.Enabled =false;
txtLable.Enabled =false;
butPreview.Text ="开始预览";
butLink.Text ="连接设备";
if(chkAdvCap.Checked )
chkAdvCap.CheckState =CheckState.Unchecked ;
visableControl(false,3);
}
}
else

...{
if(axCap.Preview )

...{
axCap.Preview =false;
axCap.Visible =false;
txtBack.Visible =true;
butCaptureImg.Enabled =false;
butPreview.Text ="开始预览";
}
butStartCap.Text ="开始捕获";
flagCapingStream=false;
axCap.EndCapture ();
}
}
}
else

...{
MessageBox.Show ("请先设置要存储的文件!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
}
}
private void chkAutoSave_CheckedChanged(object sender, System.EventArgs e)

...{
//自动保存文件
visableControl(true,1);
if(chkAutoSave.Checked )

...{
axCap.Interval =Convert.ToInt32 (txtTime.Text ,10); //首先设置自动保存周期
axCap.AutoSave =true;
}
else

...{
axCap.Interval =0;
axCap.AutoSave =false;
}
}
private void chkAutoRename_CheckedChanged(object sender, System.EventArgs e)

...{
//自动改变文件名
visableControl(true,1);
if(chkAutoRename.Checked )
axCap.AutoIncrement =true;
else
axCap.AutoIncrement =false;
}
private void chkExtJpg_CheckedChanged(object sender, System.EventArgs e)

...{
visableControl(true,1);
if(chkExtJpg.Checked )
axCap.SaveJPGProgressive =true;
else
axCap.SaveJPGProgressive =false;
}
private void butSaveFrame_Click(object sender, System.EventArgs e)

...{
if(saveFile.FileName!="")

...{
axCap.CaptureFrame ();
axCap.SaveFrame ();
}
else
MessageBox.Show ("请先设置要存储的文件!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
}
private void txtLum_TextChanged(object sender, System.EventArgs e)

...{
try

...{
axCap.SaveJPGLumFactor =Convert.ToInt32 (txtLum.Text ,10);
}
catch

...{
MessageBox.Show ("输入数据的有错,请重新输入!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
txtLum.Text ="30";
}
sclLum.Value =axCap.SaveJPGLumFactor ;
}
private void txtChrom_TextChanged(object sender, System.EventArgs e)

...{
try

...{
axCap.SaveJPGChromFactor =Convert.ToInt32 (txtChrom.Text ,10);
}
catch

...{
MessageBox.Show ("输入数据的有错,请重新输入!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
txtChrom.Text ="36";
}
sclChrom.Value =axCap.SaveJPGChromFactor ;
}
private void sclLum_ValueChanged(object sender, System.EventArgs e)

...{
txtLum.Text =sclLum.Value .ToString ();
}
private void sclChrom_ValueChanged(object sender, System.EventArgs e)

...{
txtChrom.Text =sclChrom.Value.ToString ();
}
private void txtTime_TextChanged(object sender, System.EventArgs e)

...{
try

...{
axCap.Interval =Convert.ToInt32 (txtTime.Text ,10);
}
catch

...{
MessageBox.Show ("输入数据的有错,请重新输入!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
txtTime.Text ="10";
}
axCap.CaptureFrame ();
}

/**//// <summary>
/// 连接设备
/// </summary>
public void ConnectDevice()

...{
try

...{
axCap.Connect (cobDevice.SelectedIndex ); //连接选定的设备
}
catch

...{
//连接失败的提示错误并退出程序
MessageBox.Show ("设备连接错误,请检查后重新连接!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
Application.Exit ();
}
axCap.Size =m_size;
mnuDisableLink.Enabled =true;
mnuLink.Enabled =false;
chkData.Enabled =true;
chkTime.Enabled =true;
txtLable.Enabled =true;
butPreview.Enabled =true;
butSet.Enabled =true;
butDeviceSet.Enabled =true;
butVideoFormat.Enabled =true;
cobColor.Enabled =true;
cobPix.Enabled =true;
chkAdvCap.Enabled =true;
try

...{
//枚举当前可用的色彩格式,并用来初始化组合框
for(int i=0;i<axCap .NumVideoColorFormats ;i++)
cobColor.Items .Add (axCap .ObtainVideoColorFormatName (i));
cobColor.SelectedIndex =0 ; //设置默认颜色
}
catch

...{
//枚举不成功
MessageBox.Show ("不能获取颜色!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
}
try

...{
//枚举当前可用分辨率来初始化组合框
for(int i=0;i<axCap .NumVideoResolutions ;i++)
cobPix.Items.Add (axCap .ObtainVideoResolutionName(i) );
cobPix.SelectedIndex =1 ; //设置默认分辨率
}
catch

...{
//枚举失败则提示错误
MessageBox.Show ("不能获取分辨率!","错误",MessageBoxButtons.OK ,MessageBoxIcon.Error );
}
butLink.Text ="断开连接";
}

/**//// <summary>
/// 断开连接
/// </summary>
public void DisConnect()

...{
//控制-->断开连接
axCap.Preview =false;
axCap.Disconnect();
mnuDisableLink.Enabled =false;
mnuLink.Enabled =true;
cobColor.Enabled =false;
cobPix.Enabled =false;
cobColor.Text =null;
cobColor.Items.Clear ();
cobPix.Text =null;
cobPix.Items .Clear ();
txtBack.Visible =true;
chkAdvCap.Enabled =false;
butPreview.Enabled =false;
butSet.Enabled =false;
butDeviceSet.Enabled =false;
butVideoFormat.Enabled =false;
butCaptureImg.Enabled =false;
chkData.Enabled =false;
chkTime.Enabled =false;
txtLable.Enabled =false;
butPreview.Text ="开始预览";
butLink.Text ="连接设备";
if(chkAdvCap.Checked )
chkAdvCap.CheckState =CheckState.Unchecked ;
visableControl(false,3);
}
private void butVideoComp_Click(object sender, System.EventArgs e)

...{
//配置视频编码器
axCap.ShowFilterPropertyPage (CAPTUREPRO3Lib.FILTERPROPTYPE.FILTERPROP_VIDEO_COMPRESSOR, "");
}
private void comAudioDevice_SelectedIndexChanged(object sender, System.EventArgs e)

...{
//获取音频设备
axCap.AudioDeviceIndex =comAudioDevice.SelectedIndex ;
}
private void butAudioDevice_Click(object sender, System.EventArgs e)

...{
//配置音频设备
axCap.ShowFilterPropertyPage (CAPTUREPRO3Lib.FILTERPROPTYPE.FILTERPROP_AUDIO_DEVICE , "");
}
private void comAudioComp_SelectedIndexChanged(object sender, System.EventArgs e)

...{
//获取音频编码器
axCap.AudioCompressorIndex =comAudioComp.SelectedIndex ;
}

/**//// <summary>
/// 遍历视频编码器,音频设备,音频编码器
/// </summary>
public void GetSystemInfo()

...{
if (axCap.NumVideoCompressors > 0)

...{
for (int i = 0; i < axCap.NumVideoCompressors; i++)

...{
cobVicomp.Items.Add (axCap.ObtainVideoCompressorName (i));
}
for(int i=0;i<cobVicomp.Items.Count ;i++)

...{
axCap.VideoCompressorIndex =i;
if(!axCap.HasFilterPropertyPage(CAPTUREPRO3Lib.FILTERPROPTYPE.FILTERPROP_VIDEO_COMPRESSOR))
if(!butVideoComp. Enabled )
cobVicomp.Items.RemoveAt (i);
}
if(axCap.VideoCompressorIndex ==-1)
cobVicomp.SelectedIndex =0;
else
cobVicomp.SelectedIndex =axCap.VideoCompressorIndex ;
EnableVideoComp();
}
else

...{
cobVicomp.Text ="未发现可用视频编码器";
}
if (axCap.NumAudioDevices > 0)

...{
for (int i = 0; i <axCap.NumAudioDevices; i++)

...{
comAudioDevice.Items.Add (axCap.ObtainAudioDeviceName (i));
}
if(axCap.AudioDeviceIndex ==-1)
comAudioDevice.SelectedIndex =0;
else
comAudioDevice.SelectedIndex =axCap.AudioDeviceIndex ;
}
else

...{
comAudioDevice.Text ="未发现可用音频设备";
}
if (axCap.NumAudioCompressors > 0)

...{
for (int i = 0; i < axCap.NumAudioCompressors; i++)

...{
comAudioComp.Items.Add (axCap.ObtainAudioCompressorName (i));
}
if(axCap.AudioCompressorIndex ==-1)
comAudioComp.SelectedIndex =0;
else
comAudioComp.SelectedIndex =axCap.AudioCompressorIndex ;
}
else

...{
comAudioComp.Text= "未发现可用音频编码器";
}
}
private void cobVicomp_SelectedIndexChanged(object sender, System.EventArgs e)

...{
axCap.VideoCompressorIndex = cobVicomp.SelectedIndex ;
EnableVideoComp();
}

/**//// <summary>
/// 是否可以配置视频解码器
/// </summary>
public void EnableVideoComp()

...{
if (axCap.IsConnected)// && cobVicomp.SelectedIndex >= 0)

...{
butVideoComp.Enabled =axCap.HasFilterPropertyPage(CAPTUREPRO3Lib.FILTERPROPTYPE.FILTERPROP_VIDEO_COMPRESSOR);
}
else

...{
butVideoComp.Enabled = false;
}
}
}
}