Refactoring like this is where R# really pays its way...

________________________________
From: [email protected] [mailto:[email protected]] On 
Behalf Of Anthony
Sent: Friday, 29 April 2011 8:02 AM
To: 'ozDotNet'
Subject: RE: Is it possible to override a class?

Greg...that's what i was afraid of...yeh..good idea..will create my own toolbox 
with derived controls....mmm...now i have to do a search and replace on my 
current project :)

From: [email protected] [mailto:[email protected]] On 
Behalf Of Greg Keogh
Sent: Friday, 29 April 2011 5:40 AM
To: 'ozDotNet'
Subject: RE: Is it possible to override a class?

Anthony, it sounds like you do actually want to derive a new class. A control 
is just a class. In large WinForm apps I usually create FooLabel, FooButton, 
FooPanel, etc classes and use them in place of the usual base classes. My 
FooLabel could detect a settings change for example and they would all change 
colour or font. Your derived FooButton would optionally beep when clicked.

The only nuisance is keeping all the Foo controls in the toolbox and 
remembering to use them consistently.

Greg

This email is intended for the named recipient only.  The information it 
contains may be confidential or commercially sensitive.  If you are not the 
intended recipient you must not reproduce or distribute any part of this email, 
disclose its contents to any other party, or take any action in reliance on it. 
 If you have received this email in error, please contact the sender 
immediately and delete the message from your computer.

Reply via email to