Lore,
In addition to the other comments:
| What is the difference between:
| - overriding the OnPaint Method and
| - using the Form_Paint event
The standard pattern for events in .NET is to define an overridable
protected method that calls the event. So in the case of Paint. OnPaint is
the method that raises the Paint event.
Having an overridable protected method (OnPaint in this case) allows derived
classes to raise the event, plus it allows derived classes to handle the
event in specific manner, such as pre or post processing.
http://msdn.microsoft.com/library/d...s/cpgenref/html/cpconEventUsageGuidelines.asp
http://msdn.microsoft.com/library/d.../cpgenref/html/cpconEventNamingGuidelines.asp
| what should I prefer for which aim?
I use the OnPaint method for internal (within the object) notification,
while I use Paint event itself for external (outside the object)
notification. In other words if I have an object that holds a reference to a
Form, the object would handle the Paint event. While a derived Form I would
override the OnPaint method, and be certain to call MyBase.OnPaint.
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
| Hello
|
| What is the difference between:
| - overriding the OnPaint Method and
| - using the Form_Paint event
| to do graphics?
|
| Is there a difference and what should I prefer for which aim?
|
| Thank you
| Sincerely
| Lore
|
|