1虚方法重写override 普通方法重写(重载)new
2静态方法通类
3象调虚方法
4base关键字派生类中访问基类
5开C盘方法 SystemDiagnosticsProcessStart(@C\)
6 连接浏览器方法SystemDiagnosticsProcessStart(IExplore httpwwwbaiducom)
7 开应方法SystemDiagnosticsProcessStart(notepad)
8机数:
int number1
Random rand new Random()
number1 randNext(0 100)
randNumber1Text ConvertToString(number1)
9字符串+转化 运算符 +:
Int number1 12
Int number2 32
String zz +
string expression ConvertToString(number1) + zz + ConvertToString(number2)
DataTable eval new DataTable()
object result evalCompute(expression )
MessageBoxShow(ConvertToString(result))
10创建画笔
Graphics gr CreateGraphics()
SolidBrush br new SolidBrush(color)
grFillEllipse(br eX eY size size)
11事件:KeyPress键盘读取函数
e.KeyChar
12 键确认:
if (eShift true) shiftLabelText + yes
else altLabelText + No
13键确认2:
代码:
keyCodeLabelText KeyCode+ eKeyCode
keyDateLabelText KeyData + eKeyData
keyValueLabelText KeyValue + eKeyValue
键盘Ctrl键 运行结果:
图形框:pictureBox
1 Image贴图片
ListBox(列表框)
1 items:项目
2 selectionMode选择模式(单选选选)
multiExtended(组合键进行选)
3 MultiColumn:横展示(列表足够短时候)
4 ListBox1SelectedIndex索引ListBox选中选项返回索引值序号(012)
5 ListBox1SelectedItem返回选中选项文ToString()函数转化
private void button1_Click(object sender EventArgs e)
{
listBox1ItemsAdd(textBox1Text) 添加
textBox1Clear()
}
private void button2_Click(object sender EventArgs e)
{
if(listBox1SelectedIndex 1)
{
listBox1ItemsRemoveAt(listBox1SelectedIndex) 移
}
}
private void button3_Click(object sender EventArgs e)
{
listBox1ItemsClear()清
}
6 checkedListBox(复选列表框)
默认事件SelectedIndexChanged(鼠标点中时复选框头标选中)
ItemCheck事件(复选框头标改变时)
7 PictureBox(展示图片)
8 ImagesList(储存图片数组方便调)(图片仓库)
678实例:
private void checkedListBox1_ItemCheck(object sender ItemCheckEventArgs e)
{
if(eNewValue CheckStateChecked)e项目中选中真
{
switch(eIndex) 选中第项
{
case 0pictureBox1Image imageList1Images[0] break
case 1 pictureBox2Image imageList1Images[1] break
case 2 pictureBox3Image imageList1Images[2] break
case 3 pictureBox4Image imageList1Images[3] break
case 4 pictureBox5Image imageList1Images[4] break
case 5 pictureBox6Image imageList1Images[5] break
}
}
else
{
switch (eIndex) 选中第项
{
case 0 pictureBox1Image null break
case 1 pictureBox2Image null break
case 2 pictureBox3Image null break
case 3 pictureBox4Image null break
case 4 pictureBox5Image null break
case 5 pictureBox6Image null break
}
}
}
9 ComboBox控件(拉列表框)
Items(设置控件中选项)
DropDownStyle(设置控件外观功)
Sorted(集合排序)
10 ListView(列表视图)
Activation(激活):
View属性(视图)(调节试图详细)
view details视图状态ColumnClick事件(单机列表头时发生)
11 TreeView(树状视图)
Nodes(添加节点)
ImageList方法(通ImageList控件建立联系)
NodeMouseDoubleClick(鼠标双击节点时发生)
12 控件布局(般控件属性)
锚定(Anchor)锚定窗体边框距离确定会改变拉动窗体时会着拉伸
停(dock)左右中五位置停控件会始终位置
Button1SendToBack(控件移底端)
13.窗体控件
FromBorderStyle(改变窗体边框风格)
13 qqListViewItemsAdd(花开寂寞声 0) (Items中添加名字0图片)
14 Close() 关闭程序
15 拖动窗口功代码:
private int startX startY
private void Form1_MouseMove(object sender MouseEventArgs e)
{
if(eButtonMouseButtonsLeft)
{
thisLeft + eX startX
thisTop + eY startY
}
}
private void Form1_MouseDown(object sender MouseEventArgs e)
{
if(eButtonMouseButtonsLeft)
{
startX eXstartY eY
}
}
16 MenuStrip控件中 文件(&F) 设置快捷键格式
插入分隔符方法: 菜单子菜单中选中文鼠标单击右键à插入àSeparator(会文方插入分隔符)
17 ShortcutKeys 设置快捷键
18 ContextMenuStrip 关联菜单快捷右键
19 字符串转化单精度浮点型时ConvertToSingle()
float fontSize ConvertToSingle(toolStripComboBox2SelectedItemToString())
20 toolStripComboBox2SelectedItem 选中集合
richTextBoxSelectionFont 选中字体
toolStripComboBox1ItemsAdd(familyName) 代码中添加集合方法
21 SaveFileDialog(存话框)
DialogResult result saveFileDialogShowDialog()
if (result DialogResultOK)
{
fileName saveFileDialogFileName获取路径
richTextBoxSaveFile(fileName)richTextBox中文保存fileName路径
}
22 saveFileDialog类属性InitialDirectory(话框初始目录)
validateNames(确保话框中文件夹中字符效)
overwritePrompt(覆盖重复文件夹名字时提示)
23 OpenFileDialog
24 FontDialog
25 ColorDialog
26 程序中建立新windows窗口:
1 à项目à添加windows窗体à重命名(样生成类名重命名设重命名aboutDialog)
2 新窗口类时先声明:aboutDialog result new aboutDialog()
3 调窗体中方法
27 文档界面应程序
28 子窗口排列
排列子窗口四种类型:
thisLayoutMdi(MdiLayoutArrangeIcons)
29 Windows窗体类结构层次
30 委托delegate
委托应方法相似包括返回值类型引值类型
委托目:作函数参数
文档香网(httpswwwxiangdangnet)户传
文档香网(httpswwwxiangdangnet)户传
《香当网》用户分享的内容,不代表《香当网》观点或立场,请自行判断内容的真实性和可靠性!
该内容是文档的文本内容,更好的格式请下载文档