C#设置窗体打开位置(在显示器的右下角打开)

来源:互联网 发布:免费交友软件下载 编辑:程序博客网 时间:2024/05/30 04:38

假设窗体的大小为200×120,在显示起的右下角打开。

int x= System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - 200;
int y=System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - 125;
this.SetDesktopLocation(x,y);

注释:
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width;   //当前显示器的宽度
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height; //当前显示器的高度
this.SetDesktopLocation(x,y); //设置窗体打开后在显示器上的坐标

原创粉丝点击