Reputation: 30343
When I run my application I want to display my window at right side bottom above the task bar. How do I do that?
Upvotes: 0
Views: 298
Reputation:
You can obtain the size of the screen as a Rectangle object from the Screen.PrimaryScreen.WorkingArea
property.
You can use this information to set the Left and Top properties of your form to the difference between the widths and heights of the Screen rectangle and your form, as such:
private void Form1_Load(object sender, EventArgs e)
{
Rectangle screen = Screen.PrimaryScreen.WorkingArea;
this.Left = screen.Width - this.Width;
this.Top = screen.Height - this.Height;
}
Upvotes: 2
Reputation: 187110
You can use the
Desktop coordinates are based on the working area of the screen, which excludes the taskbar. The coordinate system of the desktop is pixel based. If your application is running on a multimonitor system, the coordinates of the form are the coordinates for the combined desktop.
Upvotes: 1
Reputation: 180948
Here's an article that describes how to do it.
http://dotnetperls.com/position-windows
Upvotes: 2