I noticed that support for double buffering has been included in 
Control.cs. This is nice, except that I think the two calls to DrawImage (lines 
3177 and 3195) should pass ClientRectangle as the second parameter, rather than 
ClipRectangle of the paint event args. According to MS documentation, and 
actual behavior,  "The image represented by the image object is scaled to the 
dimensions of the rect rectangle." 
      Thus with the code as is, the code as is draws the ImageBuffer to the 
ClipRectangle. When the clip rectangle is the entire control, this makes sense. 
However, when the clip rectangle is just part of the control (like when a 
partially obstructing window is removed) the whole control is drawn to the clip 
area. (I can send an image if anyone wants to see). 

Thanks,
Jonathan

Index: Control.cs
===================================================================
--- Control.cs	(revision 43749)
+++ Control.cs	(working copy)
@@ -3173,7 +3173,7 @@
 
 					if (!needs_redraw) {
 						// Just blit the previous image
-						paint_event.Graphics.DrawImage (ImageBuffer, paint_event.ClipRectangle);
+						paint_event.Graphics.DrawImage (ImageBuffer, ClientRectangle);
 						needs_redraw = false;
 						return;
 					}
@@ -3190,7 +3190,8 @@
 					OnPaint(paint_event);
 
 					if ((control_style & ControlStyles.DoubleBuffer) != 0) {
-						dc.DrawImage (ImageBuffer, paint_event.ClipRectangle);
+						
+						dc.DrawImage (ImageBuffer, ClientRectangle);
 						paint_event.SetGraphics (dc);
 					}
 

Reply via email to