📄 cecamera.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Globalization;
using Microsoft.WindowsMobile.Forms;
using System.IO;
namespace Microsoft.WindowsMobile.Samples.CECamera
{
/// <summary>
/// Main form for the CECamera application.
/// </summary>
public class MainForm : System.Windows.Forms.Form
{
// Default values for options
private const string cecameraDefaultInitialDirectory = null;
private const string cecameraDefaultPictureFileName = "picture1";
private const string cecameraDefaultPictureExtension = ".jpg";
private const string cecameraDefaultVideoFileName = "movie1";
private const string cecameraDefaultTitle = "Title";
private const string cecameraDefaultResolutionWidth = "100";
private const string cecameraDefaultResolutionHeight = "100";
private const string cecameraDefaultVideoTimeLimit = "25";
private System.Windows.Forms.MainMenu mainMenu;
private System.Windows.Forms.MenuItem menuStart;
private System.Windows.Forms.MenuItem menuMenu;
private System.Windows.Forms.MenuItem menuMode;
private System.Windows.Forms.MenuItem menuModeStill;
private System.Windows.Forms.MenuItem menuModeVideoOnly;
private System.Windows.Forms.MenuItem menuModeVideoWithAudio;
private System.Windows.Forms.MenuItem menuStillQuality;
private System.Windows.Forms.MenuItem menuStillQualityDefault;
private System.Windows.Forms.MenuItem menuStillQualityLow;
private System.Windows.Forms.MenuItem menuStillQualityNormal;
private System.Windows.Forms.MenuItem menuStillQualityHigh;
private System.Windows.Forms.MenuItem menuVideoTypes;
private System.Windows.Forms.MenuItem menuVideoTypesAll;
private System.Windows.Forms.MenuItem menuVideoTypesStandard;
private System.Windows.Forms.MenuItem menuVideoTypesMessaging;
private System.Windows.Forms.MenuItem menuSeparator1;
private System.Windows.Forms.MenuItem menuReset;
private System.Windows.Forms.MenuItem menuAbout;
private System.Windows.Forms.MenuItem menuSeparator2;
private System.Windows.Forms.MenuItem menuExit;
private System.Windows.Forms.CheckBox checkInitialDirectory;
private System.Windows.Forms.TextBox textInitialDirectory;
private System.Windows.Forms.CheckBox checkDefaultFileName;
private System.Windows.Forms.TextBox textDefaultFileName;
private System.Windows.Forms.CheckBox checkTitle;
private System.Windows.Forms.TextBox textTitle;
private System.Windows.Forms.CheckBox checkResolution;
private System.Windows.Forms.TextBox textResolutionWidth;
private System.Windows.Forms.Label labelX;
private System.Windows.Forms.TextBox textResolutionHeight;
private System.Windows.Forms.CheckBox checkVideoTimeLimit;
private System.Windows.Forms.TextBox textVideoTimeLimit;
/// <summary>
/// Constructor
/// </summary>
public MainForm()
{
//
// Required for Windows Form Designer support
//
this.InitializeComponent();
//
// Specify all options as default value
//
this.ResetOptions();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region 窗体设计代码
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu = new System.Windows.Forms.MainMenu();
this.menuStart = new System.Windows.Forms.MenuItem();
this.menuMenu = new System.Windows.Forms.MenuItem();
this.menuMode = new System.Windows.Forms.MenuItem();
this.menuModeStill = new System.Windows.Forms.MenuItem();
this.menuModeVideoOnly = new System.Windows.Forms.MenuItem();
this.menuModeVideoWithAudio = new System.Windows.Forms.MenuItem();
this.menuStillQuality = new System.Windows.Forms.MenuItem();
this.menuStillQualityDefault = new System.Windows.Forms.MenuItem();
this.menuStillQualityLow = new System.Windows.Forms.MenuItem();
this.menuStillQualityNormal = new System.Windows.Forms.MenuItem();
this.menuStillQualityHigh = new System.Windows.Forms.MenuItem();
this.menuVideoTypes = new System.Windows.Forms.MenuItem();
this.menuVideoTypesAll = new System.Windows.Forms.MenuItem();
this.menuVideoTypesStandard = new System.Windows.Forms.MenuItem();
this.menuVideoTypesMessaging = new System.Windows.Forms.MenuItem();
this.menuSeparator1 = new System.Windows.Forms.MenuItem();
this.menuReset = new System.Windows.Forms.MenuItem();
this.menuAbout = new System.Windows.Forms.MenuItem();
this.menuSeparator2 = new System.Windows.Forms.MenuItem();
this.menuExit = new System.Windows.Forms.MenuItem();
this.checkInitialDirectory = new System.Windows.Forms.CheckBox();
this.textInitialDirectory = new System.Windows.Forms.TextBox();
this.checkDefaultFileName = new System.Windows.Forms.CheckBox();
this.textDefaultFileName = new System.Windows.Forms.TextBox();
this.checkTitle = new System.Windows.Forms.CheckBox();
this.textTitle = new System.Windows.Forms.TextBox();
this.checkResolution = new System.Windows.Forms.CheckBox();
this.textResolutionWidth = new System.Windows.Forms.TextBox();
this.labelX = new System.Windows.Forms.Label();
this.textResolutionHeight = new System.Windows.Forms.TextBox();
this.checkVideoTimeLimit = new System.Windows.Forms.CheckBox();
this.textVideoTimeLimit = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// mainMenu
//
this.mainMenu.MenuItems.Add(this.menuStart);
this.mainMenu.MenuItems.Add(this.menuMenu);
//
// menuStart
//
this.menuStart.Text = "开始";
this.menuStart.Click += new System.EventHandler(this.menuStart_Click);
//
// menuMenu
//
this.menuMenu.MenuItems.Add(this.menuMode);
this.menuMenu.MenuItems.Add(this.menuStillQuality);
this.menuMenu.MenuItems.Add(this.menuVideoTypes);
this.menuMenu.MenuItems.Add(this.menuSeparator1);
this.menuMenu.MenuItems.Add(this.menuReset);
this.menuMenu.MenuItems.Add(this.menuAbout);
this.menuMenu.MenuItems.Add(this.menuSeparator2);
this.menuMenu.MenuItems.Add(this.menuExit);
this.menuMenu.Text = "菜单";
//
// menuMode
//
this.menuMode.MenuItems.Add(this.menuModeStill);
this.menuMode.MenuItems.Add(this.menuModeVideoOnly);
this.menuMode.MenuItems.Add(this.menuModeVideoWithAudio);
this.menuMode.Text = "模式";
//
// menuModeStill
//
this.menuModeStill.Text = "静态";
this.menuModeStill.Click += new System.EventHandler(this.menuModeStill_Click);
//
// menuModeVideoOnly
//
this.menuModeVideoOnly.Text = "视频无声";
this.menuModeVideoOnly.Click += new System.EventHandler(this.menuModeVideoOnly_Click);
//
// menuModeVideoWithAudio
//
this.menuModeVideoWithAudio.Text = "视频有声";
this.menuModeVideoWithAudio.Click += new System.EventHandler(this.menuModeVideoWithAudio_Click);
//
// menuStillQuality
//
this.menuStillQuality.MenuItems.Add(this.menuStillQualityDefault);
this.menuStillQuality.MenuItems.Add(this.menuStillQualityLow);
this.menuStillQuality.MenuItems.Add(this.menuStillQualityNormal);
this.menuStillQuality.MenuItems.Add(this.menuStillQualityHigh);
this.menuStillQuality.Text = "捕获质量";
//
// menuStillQualityDefault
//
this.menuStillQualityDefault.Text = "默认";
this.menuStillQualityDefault.Click += new System.EventHandler(this.menuStillQualityDefault_Click);
//
// menuStillQualityLow
//
this.menuStillQualityLow.Text = "低";
this.menuStillQualityLow.Click += new System.EventHandler(this.menuStillQualityLow_Click);
//
// menuStillQualityNormal
//
this.menuStillQualityNormal.Text = "正常";
this.menuStillQualityNormal.Click += new System.EventHandler(this.menuStillQualityNormal_Click);
//
// menuStillQualityHigh
//
this.menuStillQualityHigh.Text = "高";
this.menuStillQualityHigh.Click += new System.EventHandler(this.menuStillQualityHigh_Click);
//
// menuVideoTypes
//
this.menuVideoTypes.MenuItems.Add(this.menuVideoTypesAll);
this.menuVideoTypes.MenuItems.Add(this.menuVideoTypesStandard);
this.menuVideoTypes.MenuItems.Add(this.menuVideoTypesMessaging);
this.menuVideoTypes.Text = "视频模式";
//
// menuVideoTypesAll
//
this.menuVideoTypesAll.Text = "所有";
this.menuVideoTypesAll.Click += new System.EventHandler(this.menuVideoTypesAll_Click);
//
// menuVideoTypesStandard
//
this.menuVideoTypesStandard.Text = "标准";
this.menuVideoTypesStandard.Click += new System.EventHandler(this.menuVideoTypesStandard_Click);
//
// menuVideoTypesMessaging
//
this.menuVideoTypesMessaging.Text = "较差";
this.menuVideoTypesMessaging.Click += new System.EventHandler(this.menuVideoTypesMessaging_Click);
//
// menuSeparator1
//
this.menuSeparator1.Text = "-";
//
// menuReset
//
this.menuReset.Text = "重设";
this.menuReset.Click += new System.EventHandler(this.menuReset_Click);
//
// menuAbout
//
this.menuAbout.Text = "关于...";
this.menuAbout.Click += new System.EventHandler(this.menuAbout_Click);
//
// menuSeparator2
//
this.menuSeparator2.Text = "-";
//
// menuExit
//
this.menuExit.Text = "退出";
this.menuExit.Click += new System.EventHandler(this.menuExit_Click);
//
// checkInitialDirectory
//
this.checkInitialDirectory.Location = new System.Drawing.Point(5, 5);
this.checkInitialDirectory.Name = "checkInitialDirectory";
this.checkInitialDirectory.Size = new System.Drawing.Size(154, 16);
this.checkInitialDirectory.TabIndex = 0;
this.checkInitialDirectory.Text = "初始文件路径";
this.checkInitialDirectory.CheckStateChanged += new System.EventHandler(this.checkInitialDirectory_CheckStateChanged);
//
// textInitialDirectory
//
this.textInitialDirectory.Location = new System.Drawing.Point(5, 25);
this.textInitialDirectory.MaxLength = 260;
this.textInitialDirectory.Name = "textInitialDirectory";
this.textInitialDirectory.Size = new System.Drawing.Size(141, 21);
this.textInitialDirectory.TabIndex = 1;
//
// checkDefaultFileName
//
this.checkDefaultFileName.Location = new System.Drawing.Point(5, 53);
this.checkDefaultFileName.Name = "checkDefaultFileName";
this.checkDefaultFileName.Size = new System.Drawing.Size(141, 16);
this.checkDefaultFileName.TabIndex = 2;
this.checkDefaultFileName.Text = "默认文件名";
this.checkDefaultFileName.CheckStateChanged += new System.EventHandler(this.checkDefaultFileName_CheckStateChanged);
//
// textDefaultFileName
//
this.textDefaultFileName.Location = new System.Drawing.Point(5, 75);
this.textDefaultFileName.MaxLength = 260;
this.textDefaultFileName.Name = "textDefaultFileName";
this.textDefaultFileName.Size = new System.Drawing.Size(141, 21);
this.textDefaultFileName.TabIndex = 3;
//
// checkTitle
//
this.checkTitle.Location = new System.Drawing.Point(5, 102);
this.checkTitle.Name = "checkTitle";
this.checkTitle.Size = new System.Drawing.Size(108, 23);
this.checkTitle.TabIndex = 4;
this.checkTitle.Text = "标题";
this.checkTitle.CheckStateChanged += new System.EventHandler(this.checkTitle_CheckStateChanged);
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -