In Control.cs in the WndProc method, the handling of the paint event is as 
follows:

case Msg.WM_PAINT: {                            
        PaintEventArgs  paint_event;

        paint_event = XplatUI.PaintEventStart(Handle);

        if ((control_style & (ControlStyles.AllPaintingInWmPaint | 
ControlStyles.UserPaint)) == (ControlStyles.AllPaintingInWmPaint | 
ControlStyles.UserPaint)) {
                OnPaintBackground(paint_event);
        }

        OnPaint(paint_event);
        XplatUI.PaintEventEnd(Handle);
        
        if (!GetStyle(ControlStyles.UserPaint)) {
                DefWndProc(ref m);
        }
        
        return;
}

If I read ths correctly, OnPaintBackground will be called if the control_style 
includes ControlStyles.AllPaintingInWmPaint and ControlStyles.UserPaint. 
     I believe this should be the opposite (change == to !=). 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
_______________________________________________
Mono-winforms-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

Reply via email to