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);
}

  

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this post.
Comments
  • No comments exist for this post.
Leave a comment

Submitted comments are subject to moderation before being displayed.

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.