Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C#.Net Newbie Question - Subclassing A Button
Message
From
03/10/2005 14:12:31
 
 
To
03/10/2005 14:01:21
General information
Forum:
ASP.NET
Category:
Class design
Miscellaneous
Thread ID:
01017131
Message ID:
01055574
Views:
18
Hey, Yuriy,

Just as a follow-up, I learned one additional thing after making that post. So here is the code I'm using now:
public class MyTextBox : System.Windows.Forms.TextBox
{
     public override Font Font 
      { 
        get { return base.Font; } 
	set {base.Font = value; }      // new line
	}  

	public MyTextBox()
	{
	base.Font = new  Font("Tahoma",8);
        }
}
The code I previously posted would handle the inheriting the way you'd expect....but didn't allow you to change the font in the property sheet. You were totally restricted to the font defined in the base class. The small change above allows you to do so.



Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform