=?Utf-8?B?VG9kZCBCcmlnaHQ=?=
1/17/2005 4:31:00 PM
Same problem. Buttons don't draw until I mouse over them. I've got the
following lines...
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);
this.UpdateStyles();
I've tried them in the Load() and OnHandleCreated() events. Both exhibit
the same incorrect results. I can't help but think that it is the UserPaint
style that is causing this. Is there some other call I need to be making in
another event to tell the control to draw itself when first displayed?
"Sean Hederman" wrote:
> Todd,
>
> I don't know if this'll help, but I always put the SetStyle call in the
> OnHandleCreated override, just after calling base.OnHandleCreated.
>
> "Todd Bright" <ToddBright@discussions.microsoft.com> wrote in message
> news:751B2DEA-0308-4769-BF65-E97B1FEF4517@microsoft.com...
> > I've got a UserControl that I've created and I am handling all painting.
> > I'm
> > using the following line of code:
> >
> > SetStyle( ControlStyles.DoubleBuffer |
> > ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true );
> >
> > The problem is that when I add this line into my control's Load() event,
> > the
> > control doesn't paint until I mouse over it. In addition, when I drag a
> > window over it, the control either doesn't repaint at all or repaints
> > partially. Everything seems to work great without this line of code???
> > Is
> > there anything else I need to do to enable double buffering? Any extra
> > events, some special code in the paint event?
> >
> > Thanks,
> > Todd
> >
> >
>
>
>