T
Tony Johansson
Hi!
The book says the following."Windows notifies an application that some
repainting needs to be done by raising a Paint event.
Interestingly, the Form class has already implemented a handler for this
event, so you don't need to add one yourself.
The Form1 handler for the Paint event will at some point in its processing
call up a virtual method, OnPaint(), passing to it a single PaintEventArgs
parameter. This means that all you need to do is override Onpaint() to
perform painting.
What I don't understand here is why they say "Paint event will at some point
in its processing call up a virtual method, OnPaint(), passing to it a
single PaintEventArgs parameter" that doesn't match to what I have read.?
I have the following understanding about this. In method OnPaint in the
control class an event Paint is raised which cause that every subscriber
will be informed by calling their event handler method for this Paint event.
If you instead override the controls OnPaint method in the Form class this
method will be called instead.When overriding the OnPaint it's important to
call base.OnPaint() so all subscriber will be notified.
//Tony
The book says the following."Windows notifies an application that some
repainting needs to be done by raising a Paint event.
Interestingly, the Form class has already implemented a handler for this
event, so you don't need to add one yourself.
The Form1 handler for the Paint event will at some point in its processing
call up a virtual method, OnPaint(), passing to it a single PaintEventArgs
parameter. This means that all you need to do is override Onpaint() to
perform painting.
What I don't understand here is why they say "Paint event will at some point
in its processing call up a virtual method, OnPaint(), passing to it a
single PaintEventArgs parameter" that doesn't match to what I have read.?
I have the following understanding about this. In method OnPaint in the
control class an event Paint is raised which cause that every subscriber
will be informed by calling their event handler method for this Paint event.
If you instead override the controls OnPaint method in the Form class this
method will be called instead.When overriding the OnPaint it's important to
call base.OnPaint() so all subscriber will be notified.
//Tony