Thread: Label question
View Single Post
  #2 (permalink)  
Old 11-10-2009, 5:08 AM
jmcilhinney's Avatar
jmcilhinney jmcilhinney is offline
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Aug 2004
Location: Sydney, Australia
Age: 40
Posts: 6,124
Reputation: 542
jmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalistjmcilhinney VB.NET gold medalist
Default

Setting the TextAlign to one of the Center values is exactly what you need to do. The thing is, you probably haven't changed the AutoSize property from its default of True. As it stands the upper left corner of the Label will stay exactly where it is and, as the Text grows in length, the Label gets wider. The centre of the Text is always in the centre of the Label, exactly as you're asking for. The problem is that the centre of the Label is moving.

In order to get the appearance you want you need to set AutoSize to False so that the Width of the Label is constant.
Reply With Quote