37

How can I place a form at the bottom-right of the screen when it loads using C#?

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
  • Related post -[Form position on lower right corner of the screen](https://stackoverflow.com/q/15188939/465053) – RBT Nov 30 '21 at 10:28

5 Answers5

84

try something on the lines of

Rectangle workingArea = Screen.GetWorkingArea(this);
this.Location = new Point(workingArea.Right - Size.Width, 
                          workingArea.Bottom - Size.Height);

Hope it works well for you.

Noam Gal
  • 3,315
  • 3
  • 36
  • 53
16
Form2 a = new Form2();
a.StartPosition = FormStartPosition.Manual;
a.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - a.Width, 
                       Screen.PrimaryScreen.WorkingArea.Height - a.Height);
KV Prajapati
  • 93,659
  • 19
  • 148
  • 186
7

This worked for me; i just put this code listed below after my InitializeComponent();

public FormProgress()
{
    this.StartPosition = FormStartPosition.Manual;
    this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
}
Andrew Bucklin
  • 699
  • 8
  • 19
1

It's easy to try;

//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); 
Umut D.
  • 1,746
  • 23
  • 24
0

In you form constructor put the following code:

StartPosition = FormStartPosition.Manual;

This will set the start position of the form to whatever you set as the value for the form's location (you can set this in the form designer).

bv8z
  • 965
  • 2
  • 9
  • 19
  • 2
    Problem with this is that everybody use different size screens, it might look fine on yours but it not to say it will on a customers... –  Sep 06 '09 at 13:34
  • +1 - Yeah, I guess you'd need that one as well, to make the form use the location you specify. – Noam Gal Sep 06 '09 at 13:35