--------------Tip:平时要善于积累常用属性
一个窗体就是一个类
Partial 部分类,一个类分别放在多个文件中;在编译时,会合并生产一个类,主要用于类比较大的时候进行拆分,或者xaml中使用也比较多。
参考文章:http://www.cnblogs.com/mdnx/archive/2012/10/29/2745564.html
多控件对齐 :参照第一个选中控件对齐
Application.Run(new TargetForm());
form.show() 显示该form窗口
属性:
BackColor:控件背景颜色
BackgroundImage:控件背景图
BackgroundImageLayout:设置背景图片的填充样式(None、Title 默认、Center居中、zoom等比例、Stretch填充)
cursor:鼠标进入的形状(No:禁止使用。。。。)
enabled:该控件是否可用
Font:字体样式
location:按钮相对于窗口左上角的位置
size:大小
textAlign:文本对齐方式
TextImageRelation:文字、图片位置
Visible:控制运行时是否可见
事件:
MouseLeave:鼠标离开触发一次
MouseEnter:鼠标进入触发一次
MouseMove:鼠标移动就触发一次
MessageBoxButtons枚举值:YesNoCancel、
MessageBoxIcon:提示图标
This.ClientSize :是工作区的大小,不包含工具栏的高度
Button.Location.X是只读的,button2.Location=new Point(x,y)来修改按钮位置
private void button2_MouseEnter(object sender, EventArgs e)
{
Random r = new Random();
int x = r.Next(0, this.ClientSize.Width - this.button2.Width);
int y = r.Next(0,this.ClientSize.Height-this.button2.Height);
Point a= new Point(x,y);
this.button2.Location = a;
//-- this.button2.Location.X+=10;//无法改变Location的值,因为它不是变量
}
activate()设为当前活动窗口
10美女时钟:
SizeMoede(Normal、StrctImage、AutoSize、CenterImage、Zoom)
Timer:
Enabled:true
Interval:1000
设置事件:Tick
dateTime.Now.Tostring(“想要的格式”)
Application.StartPath()获取当前程序所在路径
This.PictureBox.Image=Image.FromFile(path)
---------------------- ASP.Net+Android+IOS开发、 .Net培训、期待与您交流! ----------------------详细请查看: http://edu.csdn.net