C#弹出新窗体位置怎么定下来?

我设置某个窗体的按钮按下后弹出一个新窗体alarmClock = new LimitGame_v3.AlarmClock();larmClock.Location = new Point(100, 100);........alarmClock.ShowDialog();却为何每一次按下按钮后新窗体出现的位置都不一样?不在100,100?

C#设置窗体打开位置假设窗体的大小为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); //设置窗体打开后在显示器上的坐标 你可以参考一下吧
温馨提示:内容为网友见解,仅供参考
第1个回答  2015-08-14
在程序中可以用语句设定窗体的坐标Left、Top的值;
也可以直接在该窗体的参数中设定上述2项的值。
这样,就可以固定窗体的位置了。
相似回答