假设窗体的大小为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); //设置窗体打开后在显示器上的坐标
本文介绍了一种在屏幕右下角定位窗口的方法。通过获取主屏幕的工作区域尺寸,并据此计算出窗口的位置坐标,实现窗口在屏幕右下角的精确显示。
5366

被折叠的 条评论
为什么被折叠?



