Click here to Skip to main content
15,898,993 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to set Fixed Form Size in C#? And If I Run The Application form in Center How to do?
Posted
Updated 14-May-16 11:06am

You mean you don't want a sizable window? If that's the case, use for example FixedSingle for FormBorderStyle[^]

To center the window, you can use StartPosition[^]
 
Share this answer
 
If you set the form's formborderstyle to fixeddialog, then the form is not sizeable.
Yyou can also set the form startposition to make it center the entire screen or just center towards the application.
Just click the form and inspect the properties of the form using the property inspector.
 
Share this answer
 
v2
Right click on your form and go to properties.Then go to Layout options,see there are a property named Size.Change it as your need as width and length wise.Also see a property named StartPosition just after the Size property.Select it as CentreScreen..it will start your form from center of your screen.You can also change these two properties by coding during form load.Use best one according to your requirement..
 
Share this answer
 
If you're wondering about the size of your form in inches, the conversion is 96 size units per 1 inch.

96 units/1 inch

Windows form units are in DIU (Device Independent Units). This means that no matter what the resolution of the device the form is viewed on it will occupy the same number of inches on the screen.

So for instance, if you wanted a form in 8 1/2" by 11" (standard paper size). Then just multiply the desired inch values by 96 to get your windows form size values.
So 8 1/2" by 11" (Portrait view) is:
Width = (8 1/2 * 96) = 816
Height = (11 * 96) = 1056

or, if you want Landscape, 11" by 8 1/2" is:
Width = 1056
Height = 816

I find this useful for creating my own document layouts with a windows form that I can easily print on standard printer paper.
 
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