Click here to Skip to main content
13,054,329 members (118,294 online)
Rate this:
Please Sign up or sign in to vote.
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.

Posted 12-Aug-08 14:44pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 12 Aug 2008
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100