控制窗體的位置和大小
第一,生成在屏幕中央
public partial class Form1 : Form
{
? ? ? ?public Form1()
? ? ? ?{
? ? ? ? ? ?? ?InitializeComponent();
? ? ? ? ? ? ? this.StartPosition = FormStartPosition.CenterScreen;
? ? ? ?}
}
第二,生成在屏幕指定位置
需要注意,指定是用坐標(biāo)指定的。因此需要用到一組接收坐標(biāo)的代碼
public partial class Form1 : Form
{
? ? ? ?public Form1()
? ? ? ? {
? ? ? ? ? ? ?? InitializeComponent();
? ? ? ? ? ??? ?this.StartPosition = FormStartPosition.Manual;
? ? ? ? ? ? ???this.Location = new Point(80,80);//80,80是坐標(biāo),以屏幕左上角為原點(diǎn)
? ? ? ? }
}
窗體尺寸大小:

箭頭所指的坐標(biāo),就是決定窗體大小的。
標(biāo)簽: