I want to align my groupbox title to center, not the default "left", how can I do it? Thanks.
Printable View
I want to align my groupbox title to center, not the default "left", how can I do it? Thanks.
You can't.
Have a nice day.
PS, unless you do one of the following:
1. Inherit from Groupbox (or panel) and override the paint method.
2. Insert a bunch of whitespace to shove the text along a bit.
3. Write your own control from scratch.
thanks. That sounds complicated. Do you have sample code to help?
Afraid not, sorry. Maybe someone else has tackled this before.
Anyone?
It's a bit of a hack but an easy way is to not enter any text for the GroupBox and then just put a Label where you want the text to be. Note that you must make sure that the label's parent control is the form and not the group box or it will not display properly. You could create a UserControl that includes a GroupBox and a Label that will handle the positioning of the label automatically. I use a similar method to appear to include a CheckBox in the text of the group box.
Thanks.
It leaves an incomplete border space before the title text. JMcilhinney's suggestion will work
Attachment 182850