Click here to Skip to main content
12,352,739 members (60,253 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
Hi all,

Can i useoverride 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 12-Aug-08 14:44pm

1 solution

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

Solution 1

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

  Permalink  
  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 12 Aug 2008
Copyright © CodeProject, 1999-2016
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