Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How does Visual Inheritance work in .Net?
Message
De
21/06/2007 02:58:43
 
 
À
20/06/2007 23:01:37
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Divers
Thread ID:
01234107
Message ID:
01234637
Vues:
10
>Pertti,
>
>Without doing anything else, you then recompile apps using label classes B and C, and they will now display labels with Tahoma 10.
>
>Yes, that's exactly the way it will work. In fact, if the label class A's project is in the solution you are currently working in, you don't even have to rebuild the app. Just open up any form or control that was using any of these label classes, in the designer, and you'll see the change already (sometimes you *might* have to rebuild the one project where the class A was).
>
>>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.
>
>That pretty much was Kevin's first reply (which was the first answer in the thread) ... were you sleeping? <g>

Yeah, I must've. Thanks.

Pertti
>
>
>
>>>
>>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform