Skip to content

winform窗体 ​

控件 ​

Form窗口 ​

属性解释值
Text窗口左上角的名字type string
STartPosition窗口出现的位置type enum
MaximizeBox禁止和启用窗口最大化type bool
MinimizeBox禁止和启用窗口最小化type bool
AutoSizeMode窗口是否可以使用拖动来修改大小type bool
ShowInTaskbar是否在任务栏显示type bool
WindowState窗体的初始状态,最大化,最小化type enum
icon图标type file
事件解释
Load加载时 初始化
SizeChanged窗体大小发生变化
FormClosing窗体关闭前

button按钮 ​

属性解释值
TextAlign字体在按钮内部的位置type enum
Enabled按钮的启用和禁用type bool
BackColor背景颜色type T
事件解释
Click点击事件
MouseMove鼠标移动事件
MouseLeave鼠标移出
MouseHover窗体关闭前
Enter窗体关闭前
Leave窗体关闭前

textBox文本框 ​

属性解释值
MultiLine多行文本type bool
ScrollBars显示滚动条(仅限多行文本使用)type enum
PasswordChar把输入的文本使用一个字符替代type char
ReadOnly是否只读type bool
TextAlign文字在输入框的方向type enum
事件解释
TextChanged文字改变时触发
TextLength获取文本长度
SelectedText获取已选文本

Panel盒子 ​

控件

  • Panel
  • FlowLayoutPanel 流式布局
  • TablelayoutPanel 表格布局
  • GroupBox (类似Panel 多加了个标题)

位置
上:Top、下:Bottom、左:Left、右:Right、中:center

属性解释值
FlowDirection设置排列方式type enum
Anchor控件的上下左右距离父元素的距离type enum
Dock设置在父元素中上下左右的布局type enum

ComboBox下拉列表 ​

属性解释值
items集合type T
DropDownStyle显示的模式type T
DropDownWidth展开后下拉框的总体宽度type int
DropDownHeight展开后下拉框的总体高度type int
SelectedIndex选中的索引type int
Text选中的文本type string
事件解释
SelectedIndexChanged选中的索引改变的时候
SelectionChangeCommitted下拉框因选中而关闭的时候(选中自身也算)

计时器Timer ​

属性解释值
Interval时间间隔type int
Enabled显示的模式type bool
事件解释
Tick每一段时间需要执行的代码

标签 Label ​

属性解释值
AutoSize能否改变大小type bool
Font改变文字大小type T

单选框RedioButton(搭配分组控件使用) ​

属性解释值
Checked是否可以被选中type bool
AutoSize改变大小type bool
TextAlign改变文字的位置type enum
padding内边距type enum(int)
RightToLeft勾选框位置type enum
RightToLeft勾选框位置type enum
事件解释
CheckedChangedchecked属性发生变化时

复选框CheckBox ​

属性解释值
Checked是否可以被选中type bool
CheckState状态type enum
AutoSize改变大小type bool
TextAlign改变文字的位置type enum
padding内边距type enum(int)
RightToLeft勾选框位置type enum
RightToLeft勾选框位置type enum
事件解释
CheckedChangedchecked属性发生变化时
CheckStateChangedcheckState属性发生变化时

图片pictureBox ​

属性解释值
image图片路径type Image
SizeMode适应屏幕选项type enum

文件选择框 OpenFileDialog ​

事件解释
ShowDialog打开对话框(返回值是DialogResult枚举类型)

表格 DataGridView ​

属性解释值
AutoSizeColumnsMode表格表头宽度调整模式type enum
SizeMode适应屏幕选项type enum
事件解释
CellContentClick单击单元格的内容时发生

拓展 ​

  1. System.Speech //语音类
csharp
 //实例话语音类
 SpeechSynthesizer speech = new SpeechSynthesizer();
 
 //以同步的方法说出字符串的内容
 speech.Speak("你好");

Released under the MIT License.