User Control Underline Property

stustarz

Junior Contributor
Joined
Jan 10, 2003
Messages
246
Location
Earth
Hi

I am trying to create a user control that inherits from the windows forms label class.

I am, however, trying to set its Font.Underline property to True so when the control is added to the form it is automatically underlined, but this property is read only, how can i set it?

Cheers

Stu
 
You can not modify single aspects of a font, i.e. size, style, etc. You must assign the .Font property to a new instance of the Font class.

For example:

Me.Font = New Font(Me.Font, FontStyle.Underline)

This will set the label's font to a new font based on the label's current font with the style changed to underline, which is what I beleive you want to do.
 
Absouletly superb, marble! it was the lines i was going down, but just couldnt get the syntax right!

Thanks again
 
Back
Top