Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Center label

Status
Not open for further replies.

vanni75

Programmer
Nov 27, 2002
29
BE
Hoi,

I have a container with a label in it. The cpation of the label is set in in the init of the container. I want that the label adjust his position so it's in the center of the container. I've used the folowing formula :

this.lblCenter.left=this.width/2 - this.lblcenter.width/2

But what happens. The label doesn't center because the width of the label is still the old width of the old labelcaption and not the new actual width.

Can someone help me?
 
If you set the AutoSize property of the label to True its width will change dynamically with the width of the caption.

Jim
 
Hi,
I suggest you do the follwoing..

Make the Label, as long as the container itself,
with left=0

Now set the Alignment property of the Label to 2 (meaning center).

Now it is enoghh, if you set the caption property of the label in the init and leave all other settings related to this.

:)



ramani :)
(Subramanian.G)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top