c# 代码格式控件
2018-01-19 12:00:17 weixin_41225491 阅读数 239
标准控件缩写规范 

类 型

前 缀

示 例

Adrotator

adrt

adrtTopAd

BulletedList

blst

blstCity

Button

btn

btnSubmit

Calendar

cal

calMettingDates

CheckBox

chk

chkBlue

CheckBoxList

chkl

chklFavColors

DropDownList

drop

dropCountries

FileUpLoad

fup

fupImage

HiddenField

hfld

hfldName

HyperLink

hlk

hlkDetails

Image

img

imgAuntBetty

ImageButton

ibtn

ibtnSubmit

ImageMap

imap

imapSite

Label

lbl

lblResults

LinkButton

lbtn

lbtnSubmit

ListBox

lst

lstCountries

Literal

ltl

ltlTitle

Localize

loc

locChina

MultiView

mvw

mvwForm1

Panel

pnl

pnlForm2

PlaceHolder

plh

plhFormContents

RadioButton

rad

radFemale

RadioButtonList

radl

radlGender

SubStitution

subs

subsTime

Table

tbl

tblCountryCodes

TextBox

txt

txtFirstName

View

vw

vwCity

Wizard

wiz

wizRegister

Xml

xml

xmlBooks


Data Control 

类 型

前 缀

示 例

AccessDataSource

ads

adsPubs

DataList

dlst

dlstTitles

DetailView

dvw

dvwTitles

FormView

fvw

fvwFonts

GridView

gvw

gvwCity

ObjectDataSource

ods

odsMenus

Repeater

rpt

rptQueryResults

ReportViewer

rvw

rvwRecord

SiteMapDataSource

smds

smdsSite

SqlDataSource

sds

sdsBooks

XmlDataSource

xds

xdsTitles

 

Validation Control 

类 型

前 缀

示 例

CompareValidator

valc

valcValidAge

CustomValidator

valx

valxDBCheck

RangeValidator

valg

valgAge

RegularExpressionValidator

vale

valeEmail

RequiredFieldValidator

valr

valrFirstName

ValidationSummary

vals

valsFormErrors

 

Navigation Control 

类 型

前 缀

示 例

Menu

mnu

mnuUser1

SiteMapPath

smp

smpSite1

TreeView

trvw

trvwMenu

 

Login Control 

类 型

前 缀

示 例

ChangePassword

cpwd

cpwdUser1

CreateUserWizard

cuw

cuwLogin

Login

log

logCenter

LoginName

logn

lognUser

LoginStatus

logs

logsUser

LoginView

logv

logvUser

PasswordRecovery

pwdr

pwdrUser

 

WebParts Control 

类 型

前 缀

示 例

AppearanceEditorPart

paed

paedPart1

BehaviorEditorPart

pbed

pbedPart2

CatalogZone

zca

zcatCity

ConnectionsZone

zcon

zconDataBase

DeclarativeCatalogPart

pdca

pdcaPart1

EditorZone

zed

zedNews

ImportCatalogPart

pica

picaPart

LayoutEditorPart

pled

pledNews

PageCatalogPart

ppca

ppcaMail

PropertyGridEditorPart

ppge

ppgeServer

ProxyWebPartManager

mpwp

mpwpWeb

WebPartManager

mwp

mwpSite1

WebPartZone

zwp

zwpSite2

.net控件名缩写规范

基本类型: 数据类型缩写  
string str  
int i  
char chr  
sbyte sb  
byte bt  
uint ui  
long l  
ulong ul  
float f  
double d  
bool b  
decimal dec  


——————————————————————————————————————————
一、web控件 控件名缩写  
AdRotator art  
Button btn  
Calendar cd  
CheckBox chk  
CheckBoxList chkl  
CompareValidator cpv
CustomValidator ctv  
DataGrid dg  
DataList dl  
DropDownList ddl  
HyperLink hl  
Image img  
ImageButton Ibtn  
Label lbl  
ListBox lst  
Panel pl  
PlaceHolder ph  
RadioButton rb  
RadioButtonList rbl  
RangeValidator rv  
RegularExpressionValidator rev  
Repeater rp  
RequiredFieldValidator rfv  
Table tb  
TableCell tc  
TableRow tr  
TextBox txt  
ValidationSummary vs  
XML XML   
——————————————————————————————————————————
二、html控件 控件名缩写  
HtmlAnchor hah  
HtmlButton hbtn
HtmlForm hform
HtmlGenericControl hgc  
HtmlImage himg  
HtmlInputButton(按钮) htxt  
HtmlInputButton(重置) hrbtn  
HtmlInputButton(提交) hcbtn  
HtmlInputCheckBox hick  
HtmlInputFile hifile  
HtmlInputHidden hihidden  
HtmlInputImage hiimg  
HtmlInputRadioButton hirb  
HtmlInputText(密码) hpwd  
HtmlInputText(文本) hitxt  
HtmlSelect hslt  
HtmlTable htab  
HtmlTableCell htc  
HtmlTableRow htr  
HtmlTextArea htxta  

————————————————————————————————————————————
三 、ADO.NET控件 命名规范 类型前缀示例

Connection con conNorthwind  
Command cmd cmdReturnProducts  
Parameter parm parmProductID  
DataAdapter dad dadProducts  
DataReader dtr dtrProducts  
DataSet dst dstNorthWind  
DataTable dtbl dtblProduct  
DataRow drow drowRow98  
DataColumn dcol dcolProductID  
DataRelation drel drelMasterDetail  
DataView dvw dvwFilteredProducts


————————————————————————————————————————————
标准控件
1 btn Button 
2 chk CheckBox 
3 ckl CheckedListBox 
4 cmb ComboBox 
5 dtp DateTimePicker 
6 lbl Label 
7 llb LinkLabel 
8 lst ListBox 
9 lvw ListView 
10 mtx MaskedTextBox 
11 cdr MonthCalendar 
12 icn NotifyIcon 
13 nud NumeircUpDown 
14 pic PictureBox 
15 prg ProgressBar 
16 rdo RadioButton 
17 rtx RichTextBox 
18 txt TextBox 
19 tip ToolTip 
20 tvw TreeView 
21 wbs WebBrowser 
容器控件
1 flp FlowLayoutPanel 
2 grp GroupBox 
3 pnl Panel 
4 spl SplitContainer 
5 tab TabControl 
6 tlp TableLayoutPanel 
菜单和工具栏
1 cms ContextMenuStrip 
2 mns MenuStrip 
3 ssr StatusStrip 
4 tsr ToolStrip 
5 tsc ToolStripContainer 
数据
1 dts DataSet 
2 dgv DataGridView 
3 bds BindingSource 
4 bdn BindingNavigator 
5 rpv ReportViewer 
对话框
1 cld ColorDialog 
2 fbd FolderBrowserDialog 
3 fnd FontDialog 
4 ofd OpenFileDialog 
5 sfd SaveFileDialog 
组件
1 bgw BackgroundWorker 
2 dre DirectoryEntry 
3 drs DirectorySearcher 
4 err ErrorProvider 
5 evl EventLog 
6 fsw FileSystemWatcher 
7 hlp HelpProvider 
8 img ImageList 
9 msq MessageQueue 
10 pfc PerformanceCounter 
11 prc Process 
12 spt SerialPort 
13 scl ServiceController 
14 tmr Timer 
印刷
1 psd PageSetupDialog 
2 prd PrintDialog 
3 pdc PrintDocument 
4 prv PrintPreviewControl 
5 ppd PrintPreviewDialog 
水晶报表
1 crv CrystalReportViewer 
2 rpd ReportDocument 
其他
1 dud DomainUpDown 
2 hsc HScrollBar 
3 prg PropertyGrid 
4 spl Splitter 
5 trb TrackBar 
6 vsc VScrollBar


==============================================

<!--------------A----------------->
AdRotator                   ar


<!--------------B----------------->
Button                      btn


<!--------------C----------------->
Calender                    cal
CheckBox                    chk
CheckBoxList                chklst
Column (DataGridView的)     col
ColumnHeader (ListView 的) ch
Combobox                    cbo
CompareValidator            cv
CrystalReportViewer         rptvew


<!--------------D----------------->
DataGrid                    dg
DataGridView                dgv
DataList                    dl
DomainUpDown                dud
DropDownList                ddl


<!--------------F----------------->
FileUpload                  ful
Form                        frm


<!--------------G----------------->
GridView                    gv
GroupBox                    grp


<!--------------H----------------->
HiddenField                 hf


<!--------------I----------------->
Image                       img
ImageButton                 imgbtn
ImageList                   il


<!--------------L----------------->
Label                       lbl
LinkButton                  lnkbtn
ListBox                     lst
ListView                    lv


<!--------------M----------------->
MenuStrip                   ms


<!--------------O----------------->
ObjectDataSource            ods


<!--------------P----------------->
PagedDataSource             pds
Panel                       pnl
PictureBox                  pic


<!--------------R----------------->
RadioButton                 rdo
RadioButtonList             rdolst
RangeValidator              rv
RegularExpressionValidator rev
Repeater                    rpt
RequiredFieldValidator      rfv


<!--------------S----------------->
StatusLabel                 slbl
StatusStrip                 ss


<!--------------T----------------->
TabControl                  tab
Table                       tbl
TabPage                     tp
TextBox                     txt 
Timer                       tmr
ToolStrip                   ts
ToolStripButton             tsbtn
ToolStripDropDownButton     tsddb
ToolStripLabel              tslbl
ToolStripMenuItem           tsmi
TreeView                    tv/tvw


<!--------------V----------------->
ValidatorSummary            vs


<!--------------W----------------->
WebBrowser                  wb

2018-11-02 17:40:26 qq_36051316 阅读数 119

C#控件的缩写格式

本文章是转载文章,方便自己使用:参考了
https://blog.csdn.net/weixin_41225491/article/details/79105289
http://www.cnblogs.com/vincent_shi/archive/2009/11/25/1610251.html

类 型 前 缀 示 例
Adrotator adrt adrtTopAd
BulletedList blst blstCity
Button btn btnSubmit
Calendar cal calMettingDates
CheckBox chk chkBlue
CheckBoxList chkl chklFavColors
DropDownList drop dropCountries
FileUpLoad fup fupImage
HiddenField hfld hfldName
HyperLink hlk hlkDetails
Image img imgAuntBetty
ImageButton ibtn ibtnSubmit
ImageMap imap imapSite
Label lbl lblResults
LinkButton lbtn lbtnSubmit
ListBox lst lstCountries
Literal ltl ltlTitle
Localize loc locChina
MultiView mvw mvwForm1
Panel pnl pnlForm2
PlaceHolder plh plhFormContents
RadioButton rad radFemale
RadioButtonList radl radlGender
SubStitution subs subsTime
Table tbl tblCountryCodes
TextBox txt txtFirstName
View vw vwCity
Wizard wiz wizRegister
Xml xml xmlBooks

Data Control

类 型 前 缀 示 例
AccessDataSource ads adsPubs
DataList dlst dlstTitles
DetailView dvw dvwTitles
FormView fvw fvwFonts
GridView gvw gvwCity
ObjectDataSource ods odsMenus
Repeater rpt rptQueryResults
ReportViewer rvw rvwRecord
SiteMapDataSource smds smdsSite
SqlDataSource sds sdsBooks
XmlDataSource xds xdsTitles

Validation Control

类 型 前 缀 示 例
CompareValidator valc valcValidAge
CustomValidator valx valxDBCheck
RangeValidator valg valgAge
RegularExpressionValidator vale valeEmail
RequiredFieldValidator valr valrFirstName
ValidationSummary vals valsFormErrors

Navigation Control

类 型 前 缀 示 例
Menu mnu mnuUser1
SiteMapPath smp smpSite1
TreeView trvw trvwMenu

Login Control

类 型 前 缀 示 例
ChangePassword cpwd cpwdUser1
CreateUserWizard cuw cuwLogin
Login log logCenter
LoginName logn lognUser
LoginStatus logs logsUser
LoginView logv logvUser
PasswordRecovery pwdr pwdrUser

WebParts Control

类 型 前 缀 示 例
AppearanceEditorPart paed paedPart1
BehaviorEditorPart pbed pbedPart2
CatalogZone zca zcatCity
ConnectionsZone zcon zconDataBase
DeclarativeCatalogPart pdca pdcaPart1
EditorZone zed zedNews
ImportCatalogPart pica picaPart
LayoutEditorPart pled pledNews
PageCatalogPart ppca ppcaMail
PropertyGridEditorPart ppge ppgeServer
ProxyWebPartManager mpwp mpwpWeb
WebPartManager mwp mwpSite1
WebPartZone zwp zwpSite2

.net控件名缩写规范

基本类型: 数据类型缩写
string str
int i
char chr
sbyte sb
byte bt
uint ui
long l
ulong ul
float f
double d
bool b
decimal dec

——————————————————————————————————————————
一、web控件 控件名缩写
AdRotator art
Button btn
Calendar cd
CheckBox chk
CheckBoxList chkl
CompareValidator cpv
CustomValidator ctv
DataGrid dg
DataList dl
DropDownList ddl
HyperLink hl
Image img
ImageButton Ibtn
Label lbl
ListBox lst
Panel pl
PlaceHolder ph
RadioButton rb
RadioButtonList rbl
RangeValidator rv
RegularExpressionValidator rev
Repeater rp
RequiredFieldValidator rfv
Table tb
TableCell tc
TableRow tr
TextBox txt
ValidationSummary vs
XML XML
——————————————————————————————————————————
二、html控件 控件名缩写
HtmlAnchor hah
HtmlButton hbtn
HtmlForm hform
HtmlGenericControl hgc
HtmlImage himg
HtmlInputButton(按钮) htxt
HtmlInputButton(重置) hrbtn
HtmlInputButton(提交) hcbtn
HtmlInputCheckBox hick
HtmlInputFile hifile
HtmlInputHidden hihidden
HtmlInputImage hiimg
HtmlInputRadioButton hirb
HtmlInputText(密码) hpwd
HtmlInputText(文本) hitxt
HtmlSelect hslt
HtmlTable htab
HtmlTableCell htc
HtmlTableRow htr
HtmlTextArea htxta

————————————————————————————————————————————
三 、ADO.NET控件 命名规范 类型前缀示例

Connection con conNorthwind
Command cmd cmdReturnProducts
Parameter parm parmProductID
DataAdapter dad dadProducts
DataReader dtr dtrProducts
DataSet dst dstNorthWind
DataTable dtbl dtblProduct
DataRow drow drowRow98
DataColumn dcol dcolProductID
DataRelation drel drelMasterDetail
DataView dvw dvwFilteredProducts

————————————————————————————————————————————
标准控件
1 btn Button
2 chk CheckBox
3 ckl CheckedListBox
4 cmb ComboBox
5 dtp DateTimePicker
6 lbl Label
7 llb LinkLabel
8 lst ListBox
9 lvw ListView
10 mtx MaskedTextBox
11 cdr MonthCalendar
12 icn NotifyIcon
13 nud NumeircUpDown
14 pic PictureBox
15 prg ProgressBar
16 rdo RadioButton
17 rtx RichTextBox
18 txt TextBox
19 tip ToolTip
20 tvw TreeView
21 wbs WebBrowser
容器控件
1 flp FlowLayoutPanel
2 grp GroupBox
3 pnl Panel
4 spl SplitContainer
5 tab TabControl
6 tlp TableLayoutPanel
菜单和工具栏
1 cms ContextMenuStrip
2 mns MenuStrip
3 ssr StatusStrip
4 tsr ToolStrip
5 tsc ToolStripContainer
数据
1 dts DataSet
2 dgv DataGridView
3 bds BindingSource
4 bdn BindingNavigator
5 rpv ReportViewer
对话框
1 cld ColorDialog
2 fbd FolderBrowserDialog
3 fnd FontDialog
4 ofd OpenFileDialog
5 sfd SaveFileDialog
组件
1 bgw BackgroundWorker
2 dre DirectoryEntry
3 drs DirectorySearcher
4 err ErrorProvider
5 evl EventLog
6 fsw FileSystemWatcher
7 hlp HelpProvider
8 img ImageList
9 msq MessageQueue
10 pfc PerformanceCounter
11 prc Process
12 spt SerialPort
13 scl ServiceController
14 tmr Timer
印刷
1 psd PageSetupDialog
2 prd PrintDialog
3 pdc PrintDocument
4 prv PrintPreviewControl
5 ppd PrintPreviewDialog
水晶报表
1 crv CrystalReportViewer
2 rpd ReportDocument
其他
1 dud DomainUpDown
2 hsc HScrollBar
3 prg PropertyGrid
4 spl Splitter
5 trb TrackBar
6 vsc VScrollBar

==============================================

AdRotator ar

Button btn

Calender cal
CheckBox chk
CheckBoxList chklst
Column (DataGridView的) col
ColumnHeader (ListView 的) ch
Combobox cbo
CompareValidator cv
CrystalReportViewer rptvew

DataGrid dg
DataGridView dgv
DataList dl
DomainUpDown dud
DropDownList ddl

FileUpload ful
Form frm

GridView gv
GroupBox grp

HiddenField hf

Image img
ImageButton imgbtn
ImageList il

Label lbl
LinkButton lnkbtn
ListBox lst
ListView lv

MenuStrip ms

ObjectDataSource ods

PagedDataSource pds
Panel pnl
PictureBox pic

RadioButton rdo
RadioButtonList rdolst
RangeValidator rv
RegularExpressionValidator rev
Repeater rpt
RequiredFieldValidator rfv

StatusLabel slbl
StatusStrip ss

TabControl tab
Table tbl
TabPage tp
TextBox txt
Timer tmr
ToolStrip ts
ToolStripButton tsbtn
ToolStripDropDownButton tsddb
ToolStripLabel tslbl
ToolStripMenuItem tsmi
TreeView tv/tvw

ValidatorSummary vs

WebBrowser wb

2014-01-15 10:05:38 lc547913923 阅读数 1668
crtl+K,然后再按crtl+D
2017-03-10 16:16:59 ALONE_WORK 阅读数 511
ComboBox控件
1  申明
private System.Windows.Forms.ComboBox comboBox_info;

2  实例化
this.comboBox_info = new System.Windows.Forms.ComboBox();

3  设置
//
// comboBox_info
//
this.comboBox_info.Location = new System.Drawing.Point(200, 100);
this.comboBox_info.Name = "comboBox_info";
this.comboBox_info.Size = new System.Drawing.Size(100, 30);
this.comboBox_info.TabIndex = 1;
this.comboBox_info.Items.Add("this is one");
this.comboBox_info.Items.Add("this is two");
this.comboBox_info.Items.Add("this is three");
this.comboBox_info.Items.Add("this is four");
this.comboBox_info.Items.Add("this is five");
this.comboBox_info.SelectedIndex = 0;
this.comboBox_info.Text = "0";

4  加入窗口
this.Controls.Add(this.comboBox_info);
2014-08-09 17:08:14 fanganzhuanjia 阅读数 709

录像控件Demo 下载:
http://hocor.cn/sc.rar

下面是主要代码,

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WMEncoderLib;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.Threading;
using System.IO;
using System.Drawing.Drawing2D;

namespace F.ScreenCamera
{
public partial class MainForm : Form
{

//////////有关系统托盘

//////////Win32

//////////成员

///////////////////////////////////////////////////////////////////////////////////////////////
////// 程序初始化
///private void AppInit()
{
enc = new WMEncoderClass();
LoadSeting();
}
////// 设置皮肤
//////private void SetSkin(string SkinName)
{
this.skin.SerialNumber = "";
this.skin.SkinFile = "Skin\\" + SkinName + ".ssk";
}
////// 初始压缩选项列表
///private void InitCompression()
{
//
ConfigManager.AppSetings appseting = new ConfigManager.AppSetings();
string Compression = appseting.ReadKeyValue("Compression");
//
enc = new WMEncoderClass();
wspim = enc.SourcePluginInfoManager;
wspim.Refresh();
IWMEncProfileCollection wpfc = enc.ProfileCollection;
IWMEncProfile wp;
this.CompressionOptionListBox.Items.Clear();
for (int i = 0; i < wpfc.Count; i++)
{
wp = wpfc.Item(i);
this.CompressionOptionListBox.Items.Add(wp.Name);
if (wp.Name == Compression)
this.CompressionOptionListBox.SelectedIndex = i;
}

}
////// 加载设置
///private void LoadSeting()
{
ConfigManager.AppSetings appseting = new ConfigManager.AppSetings();
//是否录制声音
this.ChkSound.Checked =Convert.ToBoolean(appseting.ReadKeyValue("ChkSound"));
//是否隐藏主窗体
this.ChkHideMainForm.Checked = Convert.ToBoolean(appseting.ReadKeyValue("ChkHideMainForm"));
//快捷键设置
this.SkStartAndPause.Text = appseting.ReadKeyValue("SKey_StartAndPause");
this.SkStop.Text = appseting.ReadKeyValue("SKey_Stop");
this.SkShowAndHide.Text = appseting.ReadKeyValue("SKey_ShowAndHide");
//录制区域
int rect = Convert.ToInt32(appseting.ReadKeyValue("CameraRect"));
if (rect == 1)
this.RWindow.Checked = true;
else
this.RScreen.Checked = true;
//
Size sz = MainForm.GetScreenSize();
this.rw.Text = sz.Width.ToString();
this.rh.Text = sz.Height.ToString();
}
////// 取得选择的压缩选项
//////private IWMEncProfile2 GetSelectCompressionOption()
{
IWMEncProfileCollection wpfc = enc.ProfileCollection;
IWMEncProfile wp;
IWMEncProfile2 wp2 = new WMEncProfile2Class();
if (this.CompressionOptionListBox.SelectedIndex == -1)
{
return null;
}
for (int i = 0; i < wpfc.Count; i++)
{
wp = wpfc.Item(i);

if (this.CompressionOptionListBox.SelectedItem.ToString() == wp.Name)
{
wp2.LoadFromIWMProfile(wp);
return wp2;
}
}
return null;
}
////// 开始录制
///private void StartCamera()
{
IWMEncSourceGroupCollection SrcGrpColl;
IWMEncSourceGroup2 SrcGrp;
IWMEncAudioSource SrcAud;
IWMEncVideoSource2 SrcVid;
IWMEncProfile2 Pro;
enc = new WMEncoderClass();
//-------------------------------------------
try
{
SrcGrpColl = enc.SourceGroupCollection;
SrcGrp = (IWMEncSourceGroup2)SrcGrpColl.Add("SG_1");
SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);

//是否录制声音
if (this.ChkSound.Checked)
{
SrcAud = (IWMEncAudioSource)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
SrcAud.SetInput("Default_Audio_Device", "DEVICE", "");
}
SrcVid.SetInput("ScreenCapture1", "ScreenCap", "");

指定屏幕区域录制

//确定压缩方式
Pro = GetSelectCompressionOption();
if (Pro == null)
{
MessageBox.Show("错误!请选中 视频压缩模板!");
return;
}
SrcGrp.set_Profile(Pro);

//检查输出文件名是否为空
if (this.OutFilePathTextBox.Text.Length < 1)
{
MessageBox.Show("请指定保存路径!");
return;
}

输出文件名

enc.Start();
}
catch (Exception e1)
{
MessageBox.Show(e1.Message);
}

}
///////////////////////////////////////////////////////////////////////////////////////////////
////// 构造
///public MainForm()
{
InitializeComponent();
//Control.CheckForIllegalCrossThreadCalls = false;
//加载皮肤
ConfigManager.AppSetings appseting = new ConfigManager.AppSetings();
string skin = appseting.ReadKeyValue("skin");
this.SetSkin(skin);
//
//初始托盘
NotificationIcon();
//
//窗体大小固定
this.MinimumSize=this.Size;
this.MaximumSize = this.Size;
}
////// 主窗体加载事件
/////////private void MainForm_Load(object sender, EventArgs e)
{
AppInit();
InitCompression();
}
////// 选择输出文件保存路径
/////////private void SelectOutPathButton_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "WMV文件(*.wmv)|*.wmv";
sfd.RestoreDirectory = true;
if (sfd.ShowDialog() == DialogResult.OK)
{
this.OutFilePathTextBox.Text = sfd.FileName;
if(File.Exists(sfd.FileName))
File.Delete(sfd.FileName);
}
}
////// 开始录制
/////////private void StartButton_Click(object sender, EventArgs e)
{
if (this.CompressionOptionListBox.SelectedIndex > -1 && this.OutFilePathTextBox.Text.Trim() != "")
{

th = new Thread( new ThreadStart(start));
th.IsBackground = true;
th.Start();
//将开始按钮不可用
this.StartButton.Enabled = false;
//暂停按钮可用
this.PauseButton.Enabled = true;
//
//窗体隐藏
if (this.ChkHideMainForm.Checked)
{
this.WindowState = FormWindowState.Minimized;
this.Visible = false;
}
}
else
{
if (this.OutFilePathTextBox.Text.Trim() == "")
MessageBox.Show("请选择录像文件保存位置");
if (this.CompressionOptionListBox.SelectedIndex == -1)
MessageBox.Show("请选择一种压缩方案");
}
}
private void start()
{
VoidDelegate dstart = new VoidDelegate(StartCamera);
this.Invoke(dstart);
}
////// 停止录制按钮
/////////private void StopButton_Click(object sender, EventArgs e)
{
th.Abort();
enc.Stop();
this.StartButton.Enabled = true;
this.PauseButton.Enabled = false;

}
////// 暂停录制按钮
/////////private void PauseButton_Click(object sender, EventArgs e)

if (this.PauseButton.Text != "继续录制")
{
enc.Pause();
this.PauseButton.Text = "继续录制";
}
else
{
enc.Start();
this.PauseButton.Text = "暂停录制";
}
}
////// 单击主窗体关闭按钮
/////////private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason != CloseReason.ApplicationExitCall && e.CloseReason != CloseReason.WindowsShutDown)
{
e.Cancel = true;
this.WindowState = FormWindowState.Minimized;
this.Visible= false;
}
else
{
//none
}
}
////// 压缩选项更改
/////////private void CompressionOptionListBox_SelectedIndexChanged(object sender, EventArgs e)
{
ListBox lb = (ListBox)sender;
ConfigManager.AppSetings appseting = new ConfigManager.AppSetings();
appseting.UpdateKey("Compression", lb.Items[lb.SelectedIndex].ToString());
}
////// 压缩选项更改
/////////private void CompressionOptionListBox_MouseClick(object sender, MouseEventArgs e)
{
ListBox lb = (ListBox)sender;
ConfigManager.AppSetings appseting = new ConfigManager.AppSetings();
appseting.UpdateKey("Compression", lb.Items[lb.SelectedIndex].ToString());
}

快捷键

录制区域
////// 是否录声音
/////////private void ChkSound_CheckedChanged(object sender, EventArgs e)
{
ConfigManager.AppSetings appseting = new ConfigManager.AppSetings();
appseting.UpdateKey("ChkSound", this.ChkSound.Checked.ToString());
}
//是否隐藏主窗体
private void ChkHideMainForm_CheckedChanged(object sender, EventArgs e)
{
ConfigManager.AppSetings appseting = new ConfigManager.AppSetings();
appseting.UpdateKey("ChkHideMainForm", this.ChkHideMainForm.Checked.ToString());
}

//////////////////////////////////////////////////////////////////////////////
////// 取得屏幕大小
//////public static Size GetScreenSize()
{
//获得当前屏幕的分辨率
Screen scr = Screen.PrimaryScreen;
Rectangle rc = scr.Bounds;
Size size = new Size(rc.Width, rc.Height);
return size;
}

winForm下datetimepicker控件格式设置

博文 来自: Han_MoMo
没有更多推荐了,返回首页