drawing custom control
- From: cronusf@xxxxxxxxx
- Date: Wed, 2 Apr 2008 16:42:19 -0700 (PDT)
In my control's constructor I set:
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
My reference book, "Programming Windows Forms" by Charles Petzold says
this means that all painting logic is performed in the OnPaint
method.
I override OnPaint and do my custom drawing code. However, I noticed
that if I add child controls to my UserControl, those are painted
automatically. Can someone explain how the drawing of child controls
works?
This behavior is fine--I'd rather them automatically be drawn then
have to do it myself, I just wasn't expecting it since I figured I had
to do all the drawing for my custom control.
.
- Follow-Ups:
- RE: drawing custom control
- From: Morten Wennevik [C# MVP]
- RE: drawing custom control
- Prev by Date: Re: Auto select in listbox when user types in textbox
- Next by Date: properties and visual designer
- Previous by thread: How to print only certain page(s) in Microsoft Reports rdlc
- Next by thread: RE: drawing custom control
- Index(es):
Relevant Pages
|