将WinForm放在右下角
如何在使用C#加载时在屏幕的右下角放置一个表单?
尝试一下就行了
Rectangle workingArea = Screen.GetWorkingArea(this); this.Location = new Point(workingArea.Right - Size.Width, workingArea.Bottom - 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);
这对我有用; 我只是在我的InitializeComponent();
之后放下下面列出的3行代码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); }
在你的表单构造函数中输入以下代码:
StartPosition = FormStartPosition.Manual;
这会将表单的起始位置设置为您设置为表单位置值的任何值(您可以在表单设计器中设置它)。
这很容易尝试;
//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);