huji
asked on
Centered Text
Hello,
I have a panel, inside of which is a label. This label shows the name of a month (e.g. January, May, etc) This month name is changed based on the user input in other fields of the form. What I want to do: To make the label text appear "horizontally centered" in the panel. The default situation is the label's left position is fixed, so with the longer names (like January) the label will expand from the right side. I would like to expand equally from both sides.
Please advise
Huji
I have a panel, inside of which is a label. This label shows the name of a month (e.g. January, May, etc) This month name is changed based on the user input in other fields of the form. What I want to do: To make the label text appear "horizontally centered" in the panel. The default situation is the label's left position is fixed, so with the longer names (like January) the label will expand from the right side. I would like to expand equally from both sides.
Please advise
Huji
ASKER
>> The best thing to do here is set the width of the label to the width of the panel.
I can't do that from the properties toolbox of the VS. Should I do this programatically?
I can't do that from the properties toolbox of the VS. Should I do this programatically?
ASKER
Actually, even this didn't help:
LabelMonth.Width = PanelMonth.Width
LabelMonth.TextAlign = ContentAlignment.MiddleCen ter
LabelMonth.Width = PanelMonth.Width
LabelMonth.TextAlign = ContentAlignment.MiddleCen
You can set it via code in your panel.resize event.
With Label
.Left=0
.Top = ??
.Width = parent.width
.Height = ??
End with
With Label
.Left=0
.Top = ??
.Width = parent.width
.Height = ??
End with
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
then, centre the text.