Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
I work on VS 2013 with C# winform application. This below code does not work for me. My form was designed in 1024 x 768 resolution.

Our clients laptop is in 1366 x 768 resolution. To solve this problem, I set below code in Form Load event:

C#
this.Location = new Point(0, 0);
this.Size = Screen.PrimaryScreen.WorkingArea.Size;


but the form does not resize as per screen resolution and bottom of my form gets hidden or cut or I miss the scroll bar.

Is there any way to solve this problem? Please show me the syntax. Thanks in advance
Posted
Comments
Abdul Samad KP 24-Sep-15 17:29pm    
Set the windowState property of the form to maximized
remove your code and add below code in form load

this.WindowState=FormWindowState.Maximized;
PIEBALDconsult 24-Sep-15 19:58pm    
No, that's user-hostile; let the user decide how to view your app or he won't use it at all.

Can't you set the WindowState Property to Maximized ?

-KR
 
Share this answer
 
 
Share this answer
 
There was a known issue with PrimaryScreen.WorkingArea a few years ago: [^] the result of invoking it would be cached, and would not reflect any UI change by the user, like hiding the TaskBar.

The fix was to use: SystemInformation.WorkingArea which is reset on any UI change.

I am not sure if this problem still exists, or if this is relevant to what you are doing, but you might try using SystemInformation.

Almost too obvious to ask checklist: have you hard-coded the Form's Minimum/Maximum Size parameters ? or done anything with 'AutoSize ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900