T
Tony Johansson
Hi!
I have some problems to fully understand the OnPaint that I override in my
Form class.
I do understand when I have an event handler for the Paint event.
I mean when I override the OnPaint method this OnPaint is not an event
handler I just override an existing method that exist in a more general
class higher up and say now we use my implementation of OnPaint so windows
will call my OnPaint instead of the other method OnPaint.
I know that my OnPaint work as following when I have a windows with graphics
on and hide it by using for example the notepad and then move the notepad
away so the graphics window is not hidden my OnPaint is called.
From the functionallity of the OnPaint it work as if it was an event handler
for the Paint event but as I mentioned it's not an event handler.
If I don't override the OnPaint method but instead use an event handler for
the Paint event I think it works as this. In the OnPaint that exist above
the Form class in the control class perhaps this method OnPaint raise the
Paint event and every subscriber that subscribe to the Paint event will be
notified and the respective event handler will be called.
So it might be in this way Windows call OnPaint whatever this method is
implemented if I have overridden it Windows call my OnPaint that's it. It's
important to call base.OnPaint in my overrideen OnPaint because if there are
some subscriber to the paint event these must be notified and perhaps
Windows need to do some processing in the base method OnPaint.
So as a summary is this correct understood about the OnPaint method.
//Tony
I have some problems to fully understand the OnPaint that I override in my
Form class.
I do understand when I have an event handler for the Paint event.
I mean when I override the OnPaint method this OnPaint is not an event
handler I just override an existing method that exist in a more general
class higher up and say now we use my implementation of OnPaint so windows
will call my OnPaint instead of the other method OnPaint.
I know that my OnPaint work as following when I have a windows with graphics
on and hide it by using for example the notepad and then move the notepad
away so the graphics window is not hidden my OnPaint is called.
From the functionallity of the OnPaint it work as if it was an event handler
for the Paint event but as I mentioned it's not an event handler.
If I don't override the OnPaint method but instead use an event handler for
the Paint event I think it works as this. In the OnPaint that exist above
the Form class in the control class perhaps this method OnPaint raise the
Paint event and every subscriber that subscribe to the Paint event will be
notified and the respective event handler will be called.
So it might be in this way Windows call OnPaint whatever this method is
implemented if I have overridden it Windows call my OnPaint that's it. It's
important to call base.OnPaint in my overrideen OnPaint because if there are
some subscriber to the paint event these must be notified and perhaps
Windows need to do some processing in the base method OnPaint.
So as a summary is this correct understood about the OnPaint method.
//Tony