Protected Override code
-
Friday, September 16, 2005 2:36 AMI have just started playing with the RC of VS2005, In the current project I need to Override the OnPaint Event of the windows form. When I did this in the Beta 2 system, it produced the override and added an exception to the code. Now when I try it in RC it adds the following "base.OnPaint(e)".
Now the question I have is does this need to be in the code block if I am going to be providing the override code?
Do I leave it there, and Add my code to the event?
With the last comment about leaving it there, where do I put my code so that the over ride works correclty. Do I put it above the base call, or below.
All Replies
-
Friday, September 16, 2005 3:30 AM
Obviously, it depends on if you want the default paint behaviour, or not. If you do, then call the base method.
You should call the base method first, so that anything you paint is drawn on top of whatever the base method does. -
Friday, September 16, 2005 4:02 AMThanks I did some more playing, and worked it out.

