Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How does Visual Inheritance work in .Net?
Message
From
18/06/2007 16:24:02
 
 
To
18/06/2007 16:17:01
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgia, United States
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01234107
Message ID:
01234110
Views:
15
Hi, Calvin

The reason for this, is that when you drop subclassed controls onto a form, the Winform designer will generate code in the form for some of the standard display properties (like font). So if you go back and change the subclass, it won't be reflected on the form, because the Winform designer already generated the code.

I wrote an article in CoDe Magazine on this....I covered this on the fifth page...

http://www.code-magazine.com/article.aspx?quickid=0703092&page=5


Essentialy, in the subclass, you can't just simply set the font property. You have to do something a bit more elaborate...
override public Font Font
{
   get { return base.Font; }
   set { base.Font = value; }
}

public MyLabelClass()
{
     base.Font = new  Font("Verdana",8);
}
Hope that helps...
Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform