BLOG.CSHARPHELPER.COM: Position a form in the lower right corner accounting for the task bar in C#
Position a form in the lower right corner accounting for the task bar in C#
The Screen.PrimaryScreen.WorkingArea property gives the size of the primary screen's working area. The following code subtracts the form's width and height from the working area's Right and Bottom values to position the form in the lower right corner.
// Position the form in the lower right corner of the working area. private void Form1_Load(object sender, EventArgs e) { int x = Screen.PrimaryScreen.WorkingArea.Right - this.Width; int y = Screen.PrimaryScreen.WorkingArea.Bottom - this.Height; this.Location = new Point(x, y); }
Comments