There are mixed views on this subject.
Looking at it from a pure architecture viewpoint I would say that if there
is any intention that the final object will be derived from later then the
OnXXX overrides should be used in preference to the events. If the object,
such as a form, is known to be the final version then the events may be
used.
It is interesting to note that C# and VB design times handle these cases
differently. C# subscribes to the event and VB adds an override which is
more architecturally sound when you consider the implications for
polymorphism that handling ones own events implies.
The C# practice of adding an event handler is very bad because there is
technically no way to remove these handlers should the derived class need
to. I therefore write such handler code by hand in the case of user controls
because I write almost exclusively in C# and I require that polymorphism
rules are obeyed in case I need to derive from the user control at a later
date.
I cite this because really a user control, at least in it's design-time
mode, can be considered like a form without a title bar.
--
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.