Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
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 12-Aug-08 15: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
0 Sergey Alexandrovich Kryukov 350
1 Zoltán Zörgő 248
2 Peter Leow 235
3 CPallini 195
4 OriginalGriff 180
0 Sergey Alexandrovich Kryukov 8,963
1 OriginalGriff 6,706
2 Peter Leow 4,167
3 Zoltán Zörgő 3,714
4 Kornfeld Eliyahu Peter 2,525


Advertise | Privacy | Mobile
Web04 | 2.8.150123.1 | Last Updated 12 Aug 2008
Copyright © CodeProject, 1999-2015
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