Monday, November 13, 2006

Mix and Match Fonts on a Label Control in VB 2005

XTab's Blog - Mix and Match Fonts on a Label Control in VB 2005

"A recent post in the VBCityForums has just reminded me of a technique that I meant to blog, but don't think I ever got round to doing. This is to show how you can customise a label so that you can have text that uses different fonts on the same label.

  Normally of course, you set the font and forecolor in the Properties Window at design time, although you can also set or change them at run time too via the Font and ForeColor properties. But the key thing is that you can only have one font, one font size, one text color and one fontstyle for the whole label if you do this.

  So what happens if you want to create something that has, for instance, a heading in red text - bold style and underlined and a second line with a message in black text - regular style font ?

...

Finished Label "

This could come in handy.

I usually take the uber-lazy approach and just use different labels, but this makes it look so easy that I should think of doing it this way...

(via vbfeeds - Mix and Match Fonts on a Label Control in VB 2005)

No comments: