Re: How do you programatically set Label Font size

  • Thread starter Thread starter kimiraikkonen
  • Start date Start date
K

kimiraikkonen

I am trying to set the font size on a Label control. Seems like a simple
item but I can't find a way to do it.
I can set other properties for a Label like Borderstyle, BackColor,
Fontstyle=BOLD etc.
I'm using VB.NET 2003.

Thanks for any feedback

Hi,
Using VB 2005,
Could you find "font" on label's property window then you should be
able to tweak front types / sizes.

Or if you want to set font of label on runtime, you can use for
example;

Dim myfont As New Font("Sans Serif", 26, FontStyle.Regular)
label1.font = myfont

... where argument "26" is your font size that you can set to what you
desire.

Thanks,

Onur Güzel
 
Ozur,

Dim myfont As New Font("Sans Serif", 26, FontStyle.Regular)
label1.font = myfont

this is the same in 2003

Cor
 
Hi,
Using VB 2005,
Could you find "font" on label's property window then you should be
able to tweak front types / sizes.

Or if you want to set font of label on runtime, you can use for
example;

Dim myfont As New Font("Sans Serif", 26, FontStyle.Regular)
label1.font = myfont

... where argument "26" is your font size that you can set to what you
desire.

Thanks,

Onur Güzel

I would prefer:
label1.Font = New Fontlabel1.Font.FontFamily, 26, label1.Font.Style)

That way everything is the same except the size even if the font
family or style change later.
 
I use...

mycontrol.font.size = New System.Web.UI.WebControls.FontUnit(10)


I am trying to set the font size on a Label control. Seems like a simple
item but I can't find a way to do it.
I can set other properties for a Label like Borderstyle, BackColor,
Fontstyle=BOLD etc.
I'm using VB.NET 2003.

Thanks for any feedback
On Sunday, May 11, 2008 11:54 AM Armin Zingler wrote:
Assign a Font object to the Font property.


Armin
 
Back
Top