≡ Menu

How to fix the size of windows form at different monitor resolution

Some time developer/coder have to choose appropriate location of windows form on the screen, But limitation comes with the size and resolution of monitor. The solution is used Screen Class which gives right gives you working area of screen of monitor. Then Form load Event will look like this

private void dynamicSizeForm_Load(System.Object sender, System.EventArgse)
Screen scr = Screen.PrimaryScreen;
this.Left = (scr.WorkingArea.Width – this.Width) / 2;
this.Top = (scr.WorkingArea.Height – this.Height) / 2;
You can use above code to fix the location and size of windows form when it loads


Returns a Rectangle structure that represents the bounds
of the display area for the current screen, minus the space
taken for the taskbar and any other docked windows.

{ 0 comments… add one }

Leave a Comment