Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Visit: VBSourceSeek - The VB.NET sourcecode library

 

 

"A mere friend will agree with you, but a real friend will argue."
  • Leaders
Posted

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.

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...