Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
While making GUI project i am facing problem in aligning the text in center when i am maximizing the screen.Even if i increased the size by using property window still the size remains same when i execute it.
Posted
Comments
jai000 14-Feb-12 1:39am    
Can you explain it little bit more..
It's is windows based application or web based?
Are you displaying text using "Label" control?
akminder 15-Feb-12 8:28am    
yes it is a window application and i m displaying using label control

Use a div inside form and align center
XML
<form>
<div align="center">

</div>
</form>
 
Share this answer
 
You have mentioned where the text is written, whether on a label, textbox etc.
If the text is written on a label, to retain the text centered in the form you try the following alternatives.
1. If the label is required at the top or bottom of the form, then the label can be docked to the top or bottom of the form using the Dock property of label.
2. If the label is required at other location, then set the width equal to the form width, and set the Align property to Top or Bottom and Left,Right, so that when the form is resized, the label also gets resized.
In both the cases set the TextAlign property to MiddleCenter to keep the text centered in the label, so that the text is centered in the form too.

You may accept the solution if it solves your problem, or post your queries if any.
 
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