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

时间:2024-12-28 14:05:26
            int x = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - this.Size.Width - ;
int y = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - this.Size.Height - ;
this.SetDesktopLocation(x, y);

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