Hi,
I need to be able to vertically center the caption in a label. How can this be done? Seems like it might be an API thing...
Thanks,
Dan
Printable View
Hi,
I need to be able to vertically center the caption in a label. How can this be done? Seems like it might be an API thing...
Thanks,
Dan
The Align property? Or do you mean have the letters rotated 90°?
I don't believe there is a way to rotate a label...you can have the letters still upright but put newlines between each letter....
just my $0.02 :)
I believe he means like this...Quote:
Originally posted by filburt1
The Align property? Or do you mean have the letters rotated 90°?
--------
Caption
--------
that's how a label normally works, he wants...
--------
Caption
--------
am I right?
Steve you can make a custom control to do that if you want to, here is code you could use to do it:Quote:
Originally posted by SteveCRM
I don't believe there is a way to rotate a label...you can have the letters still upright but put newlines between each letter....
just my $0.02 :)
http://www.vbforums.com/showthread.p...ghlight=rotate
I think Microbasic has made a control to do it, ask him if you need it.
crptcblade is correct.
Also, if the font gets changed, I need the caption to remain horizontally and vertically centered..
Is this possible?
hmmm
i think that this is a little bit less complex than it needs to be. If the 'text' in the label fills less than the label height u could simply set the label to autosize and set its top position to half way (less half the label height) between the designated top and bottom positions.
Is there some design reason in your form that this approach would not be feasible?
Regards
Stuart
I'm doing it here with 2 labels. Just centering one over the other.
VB Code:
Private Sub Form_Load() With Label1 .Alignment = vbCenter .BorderStyle = vbFixedSingle End With With Label2 .Width = Label1.Width - 100 .Left = Label1.Left + 50 .Top = Label1.Top + ((Label1.Height - .Height) \ 2) End With End Sub