Also,
     I am responding to the user dragging the divider in the property grid to 
resize the two columns. In the OnMouseMove event, if the user is resizing the 
columns, I draw and then call Refresh(). Supposedly this should cause an 
immediate repaint (and the code in Control.Refresh() appears to do this). 
However, I get many more MouseMove events fired before the actual repaint 
happens (causing more draws and Refresh calls). This causes the dragging to 
appear very jagged. Is this correct behavior, I mean should I be able to 
receive many MouseMoveEvents before OnPaint is actually called  due to my call 
to Refresh?

Thanks Again,
Jonathan


-----Original Message-----
From:   [EMAIL PROTECTED] on behalf of Jonathan S. Chambers
Sent:   Thu 3/24/2005 10:31 PM
To:     [email protected]
Cc:     
Subject:        [Mono-winforms-list] Control Painting
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



_______________________________________________
Mono-winforms-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

Reply via email to