Hi,

The application I'm writing requires double buffering it
also requires a toolbar with its appearance set to flat.
However, this causes a problem because when you set the
following control styles:

SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint,true);

I've looked into this and It think its because of the
WM_ERASEBKG not being called, has anyone got a fix for
this, I don't know how to manually send this message and
at what time?

John

Re: Toolbar flat style and double buffering by Bob

Bob
Mon Oct 27 03:38:30 CST 2003

Setting the UserPaint style suppresses the WM_ERASEBKGND message and you are
supposed to call the OnPaintBackground explicitly in the drawing handler if
you still need it's default functionality.

--
Bob Powell [MVP]
C#, System.Drawing

The October edition of Well Formed is now available.
Find out how to use DirectX in a Windows Forms control
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Blog http://bobpowelldotnet.blogspot.com

"John" <anonymous@discussions.microsoft.com> wrote in message
news:05c801c39c6d$10783eb0$a401280a@phx.gbl...
> Hi,
>
> The application I'm writing requires double buffering it
> also requires a toolbar with its appearance set to flat.
> However, this causes a problem because when you set the
> following control styles:
>
> SetStyle(ControlStyles.DoubleBuffer, true);
> SetStyle(ControlStyles.AllPaintingInWmPaint, true);
> SetStyle(ControlStyles.UserPaint,true);
>
> I've looked into this and It think its because of the
> WM_ERASEBKG not being called, has anyone got a fix for
> this, I don't know how to manually send this message and
> at what time?
>
> John
>



Re: Toolbar flat style and double buffering by John

John
Mon Oct 27 04:01:52 CST 2003

Thanks Bob,

Is this in the paint event?

i.e

base.OnPaintBackground()

John

>-----Original Message-----
>Setting the UserPaint style suppresses the WM_ERASEBKGND
message and you are
>supposed to call the OnPaintBackground explicitly in the
drawing handler if
>you still need it's default functionality.
>
>--
>Bob Powell [MVP]
>C#, System.Drawing
>
>The October edition of Well Formed is now available.
>Find out how to use DirectX in a Windows Forms control
>http://www.bobpowell.net/currentissue.htm
>
>Answer those GDI+ questions with the GDI+ FAQ
>http://www.bobpowell.net/gdiplus_faq.htm
>
>Blog http://bobpowelldotnet.blogspot.com
>
>"John" <anonymous@discussions.microsoft.com> wrote in
message
>news:05c801c39c6d$10783eb0$a401280a@phx.gbl...
>> Hi,
>>
>> The application I'm writing requires double buffering it
>> also requires a toolbar with its appearance set to flat.
>> However, this causes a problem because when you set the
>> following control styles:
>>
>> SetStyle(ControlStyles.DoubleBuffer, true);
>> SetStyle(ControlStyles.AllPaintingInWmPaint, true);
>> SetStyle(ControlStyles.UserPaint,true);
>>
>> I've looked into this and It think its because of the
>> WM_ERASEBKG not being called, has anyone got a fix for
>> this, I don't know how to manually send this message and
>> at what time?
>>
>> John
>>
>
>
>.
>

Re: Toolbar flat style and double buffering by Bob

Bob
Mon Oct 27 07:05:20 CST 2003

> base.OnPaintBackground()
yes, but with the PaintEventArgs handed in from the Paint handler.
Otherwise you can just paint your background explicitly in the Paint
handler.

--
Bob Powell [MVP]
C#, System.Drawing

The October edition of Well Formed is now available.
Find out how to use DirectX in a Windows Forms control
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Blog http://bobpowelldotnet.blogspot.com

"John" <anonymous@discussions.microsoft.com> wrote in message
news:06ea01c39c71$588dc770$a301280a@phx.gbl...
> Thanks Bob,
>
> Is this in the paint event?
>
> i.e
>
> base.OnPaintBackground()
>
> John
>
> >-----Original Message-----
> >Setting the UserPaint style suppresses the WM_ERASEBKGND
> message and you are
> >supposed to call the OnPaintBackground explicitly in the
> drawing handler if
> >you still need it's default functionality.
> >
> >--
> >Bob Powell [MVP]
> >C#, System.Drawing
> >
> >The October edition of Well Formed is now available.
> >Find out how to use DirectX in a Windows Forms control
> >http://www.bobpowell.net/currentissue.htm
> >
> >Answer those GDI+ questions with the GDI+ FAQ
> >http://www.bobpowell.net/gdiplus_faq.htm
> >
> >Blog http://bobpowelldotnet.blogspot.com
> >
> >"John" <anonymous@discussions.microsoft.com> wrote in
> message
> >news:05c801c39c6d$10783eb0$a401280a@phx.gbl...
> >> Hi,
> >>
> >> The application I'm writing requires double buffering it
> >> also requires a toolbar with its appearance set to flat.
> >> However, this causes a problem because when you set the
> >> following control styles:
> >>
> >> SetStyle(ControlStyles.DoubleBuffer, true);
> >> SetStyle(ControlStyles.AllPaintingInWmPaint, true);
> >> SetStyle(ControlStyles.UserPaint,true);
> >>
> >> I've looked into this and It think its because of the
> >> WM_ERASEBKG not being called, has anyone got a fix for
> >> this, I don't know how to manually send this message and
> >> at what time?
> >>
> >> John
> >>
> >
> >
> >.
> >