如何使用C#加载表单在屏幕的右下角?
答案 0 :(得分:56)
尝试一下
Rectangle workingArea = Screen.GetWorkingArea(this);
this.Location = new Point(workingArea.Right - Size.Width,
workingArea.Bottom - Size.Height);
希望它适合你。
答案 1 :(得分:11)
Form2 a = new Form2();
a.StartPosition = FormStartPosition.Manual;
a.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - a.Width,
Screen.PrimaryScreen.WorkingArea.Height - a.Height);
答案 2 :(得分:2)
这对我有用;我只是在InitializeComponent();
public FormProgress()
{
InitializeComponent();
Rectangle r = Screen.PrimaryScreen.WorkingArea;
this.StartPosition = FormStartPosition.Manual;
this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
}
答案 3 :(得分:0)
在你的表单构造函数中输入以下代码:
StartPosition = FormStartPosition.Manual;
这会将表单的起始位置设置为您设置为表单位置值的任何值(您可以在表单设计器中设置它)。
答案 4 :(得分:0)
很容易尝试;
//Get screen resolution
Rectangle res = Screen.PrimaryScreen.Bounds;
// Calculate location (etc. 1366 Width - form size...)
this.Location = new Point(res.Width - Size.Width, res.Height - Size.Height);