2006-10-10 Chris Toshok <toshok@ximian.com>
authorChris Toshok <toshok@novell.com>
Tue, 10 Oct 2006 21:51:36 +0000 (21:51 -0000)
committerChris Toshok <toshok@novell.com>
Tue, 10 Oct 2006 21:51:36 +0000 (21:51 -0000)
* Control.cs (WM_PAINT): when a control is double buffered we draw
initially to the ImageBuffer and then copy from there.  But when a
parent control which has child controls is double buffered, the
initial drawing doesn't encompass the entire ClientRectangle of
the parent control, so we end up with uninitialized bits (this is
easily seen by dragging the top toolbar in
wf-apps/ToolBarDockExample to the right, quickly).  The fix is to
manually set the ClipRectangle of the paint_event (only the one we
use to populate the ImageBuffer) to ClientRectangle.  Fixes more
of the nastiness in bug #72499.

* PaintEventArgs.cs: Add an internal setter for ClipRectangle,
which we use in Control.cs's WM_PAINT handling.

svn path=/trunk/mcs/; revision=66532

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs

index 2b5ad0ffe1317ac818be49f6ad4f95bb7ad68b67..e5f21a44afbc37faac8681db3153f9ed5916c85e 100644 (file)
@@ -1,3 +1,19 @@
+2006-10-10  Chris Toshok  <toshok@ximian.com>
+
+       * Control.cs (WM_PAINT): when a control is double buffered we draw
+       initially to the ImageBuffer and then copy from there.  But when a
+       parent control which has child controls is double buffered, the
+       initial drawing doesn't encompass the entire ClientRectangle of
+       the parent control, so we end up with uninitialized bits (this is
+       easily seen by dragging the top toolbar in
+       wf-apps/ToolBarDockExample to the right, quickly).  The fix is to
+       manually set the ClipRectangle of the paint_event (only the one we
+       use to populate the ImageBuffer) to ClientRectangle.  Fixes more
+       of the nastiness in bug #72499.
+
+       * PaintEventArgs.cs: Add an internal setter for ClipRectangle,
+       which we use in Control.cs's WM_PAINT handling.
+
 2006-10-10  Jackson Harper  <jackson@ximian.com>
 
        * TextBoxBase.cs: Finish off the autoscrolling stuff.
index 280cef3e380f50e7e5900383c5344d739c8d8545..aa9a14731f371352b00f2ef13ddcf216e9397678 100644 (file)
@@ -3979,8 +3979,11 @@ namespace System.Windows.Forms
                                        }
 
                                        Graphics dc = null;
+                                       Rectangle old_clip_rect = Rectangle.Empty;
                                        if (ThemeEngine.Current.DoubleBufferingSupported) {
                                                if ((control_style & ControlStyles.DoubleBuffer) != 0) {
+                                                       old_clip_rect = paint_event.ClipRectangle;
+                                                       paint_event.ClipRectangle = ClientRectangle;
                                                        dc = paint_event.SetGraphics (DeviceContext);
                                                        reset_context = true;
                                                }
@@ -4000,6 +4003,7 @@ namespace System.Windows.Forms
 
                                        if (ThemeEngine.Current.DoubleBufferingSupported)
                                                if ((control_style & ControlStyles.DoubleBuffer) != 0) {
+                                                       paint_event.ClipRectangle = old_clip_rect;
                                                        dc.DrawImage (ImageBuffer, paint_event.ClipRectangle, paint_event.ClipRectangle, GraphicsUnit.Pixel);
                                                        paint_event.SetGraphics (dc);
                                                        needs_redraw = false;
index dde39b31f3df36a90aa14ec66a31d41927d0523e..8c13d17cddd45a9fc0a6410abeab1423008d072f 100644 (file)
@@ -52,6 +52,9 @@ namespace System.Windows.Forms {
                        get {
                                return this.clip_rectangle;
                        }
+                       internal set {
+                               this.clip_rectangle = value;
+                       }
                }
 
                public Graphics Graphics {