Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How does Visual Inheritance work in .Net?
Message
From
20/06/2007 20:50:33
 
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01234107
Message ID:
01234608
Views:
22
>
>Just so that everyone is clear....the reason for this, is because the Winform designer generates code for the control in the form's InitializeComponent, when you drop the control on the form and start setting other properties for the control (like name, etc.).
>
>The simple way to prevent this is to override the Font property and use the base keyword, in your subclass. That's IT...that's all you have to do, it's simply in your subclass class, and then inheritance will work cleanly. Very very small price to pay. Most .NET people just address it and move on to more important things.

Thanks, Kevin.

That's it, huh? Allrightie, then...

Not to belabour the point, but just to make sure I get this right (clearly I haven't messed around with font changes on inherited .NET labels before). Let's say we have label classes A->B->C. A inherits from .NET base label, but sets font to Arial 8. B inherits from A and C inherits from B. Apps are written and labels are sprinkled all over the place using the inherited label classes B and C. Eventually you set class A's font to, say, Tahoma 10. Without doing anything else, you then recompile apps using label classes B and C, and they will now display labels with Tahoma 10.

If that's the case, it would've been nice to have this answer as the first one in this thread, because that would've stopped the thread right there. But better late than never.

Pertti
>
>
>Kevin
Pertti Karjalainen
Product Manager
Northern Lights Software
Fairfax, CA USA
www.northernlightssoftware.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform