stustarz Posted February 1, 2005 Posted February 1, 2005 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 Quote Visit: VBSourceSeek - The VB.NET sourcecode library "A mere friend will agree with you, but a real friend will argue."
donnacha Posted February 1, 2005 Posted February 1, 2005 You need to overide the paint method of the control and do it there Quote Hamlet
Leaders snarfblam Posted February 1, 2005 Leaders Posted February 1, 2005 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. Quote [sIGPIC]e[/sIGPIC]
stustarz Posted February 1, 2005 Author Posted February 1, 2005 Absouletly superb, marble! it was the lines i was going down, but just couldnt get the syntax right! Thanks again Quote Visit: VBSourceSeek - The VB.NET sourcecode library "A mere friend will agree with you, but a real friend will argue."
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.