Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
5.00/5 (3 votes)
See more:
Hi all,

Can i use override void OnPaintBackground in custom user control?My purpose to use this method in custom user control is because i will draw the base line (grid) as image in the drawing area at the initiate state, but after that, i don't want to repaint again the background(image) when i draw some line on it. Thus, i need to override the OnPaintBackground method and disable it to fulfill my purpose. I can done it in Component,but how about in custom user control?[confused]

Any tips are welcome.

regards
cocoonwls
Posted

1 solution

Hi,
you can override OnPaintBackground, I haven't have any problem with that so far. If you want to draw over default background, be sure to call base.OnPaintBackground as a first thing in your override method. If you want to draw your background completely by yourself, don't call base.OnPaintBackground at all.
hope this helps

 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900