Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form position on lower right corner of the screen

I am using c# WinForm to develop a sman notification app. I would like to place the main form on the lower right corner of the screen working area. In case of multiple screens, there is a way to find the rightmost screen where to place the app, or at least remember the last used screen and palce the form on its lower right corner?

like image 215
Terix Avatar asked Mar 03 '13 18:03

Terix


1 Answers

Override the Form Onload and set the new location :

protected override void OnLoad(EventArgs e)
{
    var screen = Screen.FromPoint(this.Location);
    this.Location = new Point(screen.WorkingArea.Right - this.Width, screen.WorkingArea.Bottom - this.Height);
    base.OnLoad(e);
}
like image 62
Sami Franka Avatar answered Sep 22 '22 05:09

Sami Franka