[Mono-winforms-list] Control Painting
Jonathan S. Chambers
Jonathan.Chambers@ansys.com
Thu, 24 Mar 2005 22:31:21 -0500
In Control.cs in the WndProc method, the handling of the paint event is =
as follows:
case Msg.WM_PAINT: { =09
PaintEventArgs paint_event;
paint_event =3D XplatUI.PaintEventStart(Handle);
if ((control_style & (ControlStyles.AllPaintingInWmPaint | =
ControlStyles.UserPaint)) =3D=3D (ControlStyles.AllPaintingInWmPaint | =
ControlStyles.UserPaint)) {
OnPaintBackground(paint_event);
}
OnPaint(paint_event);
XplatUI.PaintEventEnd(Handle);
=09
if (!GetStyle(ControlStyles.UserPaint)) {
DefWndProc(ref m);
}
=09
return;
}
If I read ths correctly, OnPaintBackground will be called if the =
control_style includes ControlStyles.AllPaintingInWmPaint and =
ControlStyles.UserPaint.=20
I believe this should be the opposite (change =3D=3D to !=3D). If =
ControlStyles.AllPaintingInWmPaint and ControlStyles.UserPaint are set =
(i.e. everything is done in OnPaint), OnPaintBackground should not be =
called.
I have tried to change my drawing code from using the WndProc to =
overriding OnPaint. This change helps a bit (I don't see the background =
color flash), but my drawing seems much slower (almost as if double =
buffering is not working with this method???).
- Jonathan