【发布时间】:2010-11-26 00:29:05
【问题描述】:
如何在使用 C# 加载时将表单放置在屏幕的右下角?
【问题讨论】:
如何在使用 C# 加载时将表单放置在屏幕的右下角?
【问题讨论】:
这对我有用;我只是把下面列出的这段代码放在我的InitializeComponent();
public FormProgress()
{
this.StartPosition = FormStartPosition.Manual;
this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
}
【讨论】:
很容易尝试;
//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);
【讨论】:
Form2 a = new Form2();
a.StartPosition = FormStartPosition.Manual;
a.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - a.Width,
Screen.PrimaryScreen.WorkingArea.Height - a.Height);
【讨论】:
尝试一下
Rectangle workingArea = Screen.GetWorkingArea(this);
this.Location = new Point(workingArea.Right - Size.Width,
workingArea.Bottom - Size.Height);
希望它对你有用。
【讨论】:
在你的表单构造函数中输入以下代码:
StartPosition = FormStartPosition.Manual;
这会将表单的起始位置设置为您设置为表单位置值的任何值(您可以在表单设计器中设置)。
【讨论】: