Yes, there definitely is. It is the OnPaint method that does the painting.
The Paint event is an event raised by this method. So, you already have
additional indirection going on there. In fact, since the OnPaint method is
protected, it is clearly the intent that the Paint event (and other events)
be used by other classes, rather than the one doing the painting. Events are
notifications, and they involve the creation of delegate instances and the
Message Pump. If you override OnPaint, no delegate instances must be
assigned.
To put it more simply, consider the following:
protected virtual void OnPaint(PaintEventArgs e)
{
// Paint the control
// ...
// Raise the Paint event.
if (Paint != null)
Paint(this, e);
}
If you override the above, you do not need to assign a delegate to handle
the event, and the second line of code illustrated (raising the event, or
executing the delegates assigned to it) is not executed.
--
HTH,
Kevin Spencer
Microsoft MVP
Digital Carpenter
A man, a plan, a canal,
a palindrome that has gone to s**t.