Application.Exit();//关闭整个应用程序。
//打开另一个子窗口
项目name a = new 项目name();
无模式窗口 a.Show(); a.visible = ture; /////// 有模式窗口a.ShowDialog();
------------------------------------
关闭窗口
this close();
隐藏窗体
a.visible = false;
------------------------------------------
控件 Openfiledialog
//show the open file dialog box.打开文件会话框
(控件的名字Openfiledialog.ShowDialog()==DialogResult.OK)
-------------------
//将图片存入图片对话框里
图片框name.Image = Image.FromFile(控件的name Openfiledialog.FileName);
--------------------------------
//show the name of the file in the form's caption 动态应用,不断调整属性
this.Text = string.Concat("窗口的textname(" + 控件的name Openfiledialog.FileName + ")");
--------------------------------------------
//创建一个变量
string strFirstName;
//不返回值的过程
public void MyProcedure()
{
//过程代码
}
//返回值的过程
public string AuthorName()
{
//过程代码
ruturn " ";
}
//返回值的过程中接受参数
public string AuthorName( string BookName)
{
//过程代码
ruturn " ";
}
------------------------------------------
// 消息框
MessageBox.Show("");
--------------------------------------------------------
//Click改变窗口大小
this.Width = this.Width - 20;
this.Height = this.Height - 20;
---------------------------------
//触发方法
对象name.方法();
-------------------------------
//封装画图
Graphics 变量名字 = null;
变量名字 = this.CreateGraphics();
变量名字 .Clear(SystemColors.Control);
变量名字.DrawRectangle(Pens.Blue,
涂画框name.Left - 1, picShowPicture.Top - 1,
picShowPicture.Width + 1, picShowPicture.Height + 1);
-----------------------------------
//清理工作
变量名.Dispose();
//销毁对象
变量名.Dispose();
---------------------------------------
//看有多少个组件
for(int intIndex =0;intIndex < this.Controls.Count;intIndex++)
{
MessageBox.Show("Control #" + intIndex.ToString() +
"has the name" + this.Controls[intIndex].Name);
}
-----------------------------------------
//光标坐标显示
名字lblX.Text = "X: " + e.X.ToString();
lblY.Text = "Y: " + e.Y.ToString();
//初始化标签load事件中
lblX.Text = " ";
lblY.Text = " ";
------------------------------------------------
-------------------------
-------------------------------
窗体的属性 controlbox 设置为false,隐藏关闭缩小,放大
焦点窗口 属性topmost
透明属性 opacity
滚动条 autoscroll
窗口变为父窗口 ismdicontainer
父窗体中
fclsChild_1 objChild = new fclsChild_1();
objChild.MdiParent = this;
objChild.Show();
子窗体中click事件
fclsChild_2 objChild = new fclsChild_2();
objChild.MdiParent = this.MdiParent;
objChild.Show();
文本框调整 multiline
scrollbars增加滚动条
acceptreturn 可使用户按回车键
maxlength 限制用户输入的数字
passwordchar 设置密码字段
grop box 用来显示长的说明文字 分组框
listbox列表框 items操作集合
增加 列表name.Items.Add("DSDFDFSFFDFF");
特定位置增加 列表名字.Items.Insert(0,"DSDFDFSFFDFF");
删除 列表名字.Items.Remove("123");
删除 列表名字.Items.RemoveAt(0);
清除所有 列表名字.Items.Clear();
MessageBox.Show("You selected" + 列表名.SelectedItems +
"which has an index of" + 列表名.SelectedIndex);
sorted 强制排序
check box用来复选框
radiobutton 单选框
combobox 选择列表框 dropdownstyle改为 ····list限制输入
timer控件 enabled值改为ture interval决定触发间隔时间
//ToLongTimeString();以hh:mm:SS以字符串的形式返回
labl的名字.Text = DateTime.Now.ToLongTimeString();
带标签页的对话框
tapcontrol tabpages
imagelist 存储图像并被其他控件所用
list view可创建简单的列表,多列网格,图标托盘
columns列集合
属性fullrowselect
menustrip main menu控件
//设置与当前的cheek相反的值
mnuConfirmOnExit.Checked = !(mnuConfirmOnExit.Checked);
context menu strip 右键菜单
toolstrip 工具栏
statusstrip菜单工具栏
---------------------
private void ···()
{}
返回值 Private int 方法名(参数 string....)
{
return ...Length;
}
定义常量
const 数据类型 常数名 = 值
//打开另一个子窗口
项目name a = new 项目name();
无模式窗口 a.Show(); a.visible = ture; /////// 有模式窗口a.ShowDialog();
------------------------------------
关闭窗口
this close();
隐藏窗体
a.visible = false;
------------------------------------------
控件 Openfiledialog
//show the open file dialog box.打开文件会话框
(控件的名字Openfiledialog.ShowDialog()==DialogResult.OK)
-------------------
//将图片存入图片对话框里
图片框name.Image = Image.FromFile(控件的name Openfiledialog.FileName);
--------------------------------
//show the name of the file in the form's caption 动态应用,不断调整属性
this.Text = string.Concat("窗口的textname(" + 控件的name Openfiledialog.FileName + ")");
--------------------------------------------
//创建一个变量
string strFirstName;
//不返回值的过程
public void MyProcedure()
{
//过程代码
}
//返回值的过程
public string AuthorName()
{
//过程代码
ruturn " ";
}
//返回值的过程中接受参数
public string AuthorName( string BookName)
{
//过程代码
ruturn " ";
}
------------------------------------------
// 消息框
MessageBox.Show("");
--------------------------------------------------------
//Click改变窗口大小
this.Width = this.Width - 20;
this.Height = this.Height - 20;
---------------------------------
//触发方法
对象name.方法();
-------------------------------
//封装画图
Graphics 变量名字 = null;
变量名字 = this.CreateGraphics();
变量名字 .Clear(SystemColors.Control);
变量名字.DrawRectangle(Pens.Blue,
涂画框name.Left - 1, picShowPicture.Top - 1,
picShowPicture.Width + 1, picShowPicture.Height + 1);
-----------------------------------
//清理工作
变量名.Dispose();
//销毁对象
变量名.Dispose();
---------------------------------------
//看有多少个组件
for(int intIndex =0;intIndex < this.Controls.Count;intIndex++)
{
MessageBox.Show("Control #" + intIndex.ToString() +
"has the name" + this.Controls[intIndex].Name);
}
-----------------------------------------
//光标坐标显示
名字lblX.Text = "X: " + e.X.ToString();
lblY.Text = "Y: " + e.Y.ToString();
//初始化标签load事件中
lblX.Text = " ";
lblY.Text = " ";
------------------------------------------------
-------------------------
-------------------------------
窗体的属性 controlbox 设置为false,隐藏关闭缩小,放大
焦点窗口 属性topmost
透明属性 opacity
滚动条 autoscroll
窗口变为父窗口 ismdicontainer
父窗体中
fclsChild_1 objChild = new fclsChild_1();
objChild.MdiParent = this;
objChild.Show();
子窗体中click事件
fclsChild_2 objChild = new fclsChild_2();
objChild.MdiParent = this.MdiParent;
objChild.Show();
文本框调整 multiline
scrollbars增加滚动条
acceptreturn 可使用户按回车键
maxlength 限制用户输入的数字
passwordchar 设置密码字段
grop box 用来显示长的说明文字 分组框
listbox列表框 items操作集合
增加 列表name.Items.Add("DSDFDFSFFDFF");
特定位置增加 列表名字.Items.Insert(0,"DSDFDFSFFDFF");
删除 列表名字.Items.Remove("123");
删除 列表名字.Items.RemoveAt(0);
清除所有 列表名字.Items.Clear();
MessageBox.Show("You selected" + 列表名.SelectedItems +
"which has an index of" + 列表名.SelectedIndex);
sorted 强制排序
check box用来复选框
radiobutton 单选框
combobox 选择列表框 dropdownstyle改为 ····list限制输入
timer控件 enabled值改为ture interval决定触发间隔时间
//ToLongTimeString();以hh:mm:SS以字符串的形式返回
labl的名字.Text = DateTime.Now.ToLongTimeString();
带标签页的对话框
tapcontrol tabpages
imagelist 存储图像并被其他控件所用
list view可创建简单的列表,多列网格,图标托盘
columns列集合
属性fullrowselect
menustrip main menu控件
//设置与当前的cheek相反的值
mnuConfirmOnExit.Checked = !(mnuConfirmOnExit.Checked);
context menu strip 右键菜单
toolstrip 工具栏
statusstrip菜单工具栏
---------------------
private void ···()
{}
返回值 Private int 方法名(参数 string....)
{
return ...Length;
}
定义常量
const 数据类型 常数名 = 值