[Mono-bugs] [Bug 77734][Nor] Changed - [PATCH] Graphics.Transform isn't resetted between calls to Paint

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue May 16 02:57:45 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by atsushi at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=77734

--- shadow/77734	2006-05-09 20:46:11.000000000 -0400
+++ shadow/77734.tmp.4967	2006-05-16 02:57:45.000000000 -0400
@@ -10,14 +10,14 @@
 Component: Windows.Forms
 AssignedTo: peter at novonyx.com                            
 ReportedBy: paul at all-the-johnsons.co.uk               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
 URL: 
-Cc: peter at novonyx.com,sebastien at ximian.com
-Summary: Graphics.Transform isn't resetted between calls to Paint
+Cc: atsushi at ximian.com,peter at novonyx.com,sebastien at ximian.com
+Summary: [PATCH] Graphics.Transform isn't resetted between calls to Paint
 
 Please fill in this template when reporting a bug, unless you know what you
 are doing.
 Description of Problem:
 If you compile the test code attached, and run you will see that instead of
 the clock being displayed once, it is being redrawn a number of times. When
@@ -105,6 +105,53 @@
     True
     ...
 but I got no clue where it should be done ;-)
 
 ------- Additional Comments From sebastien at ximian.com  2006-05-09 20:46 -------
 *** Bug 78350 has been marked as a duplicate of this bug. ***
+
+------- Additional Comments From atsushi at ximian.com  2006-05-16 02:57 -------
+Simplified testcase:
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Drawing.Drawing2D;
+
+namespace AnalogClock
+{
+  public class MyClick : Form
+  {
+    static void Main()
+    {
+      Application.Run(new MyClick());
+    }
+
+    public MyClick()
+    {
+      Text = "click me";
+      this.Paint += new PaintEventHandler(f1_paint);
+      this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
+      this.SetStyle(ControlStyles.UserPaint, true);
+      this.SetStyle(ControlStyles.DoubleBuffer, true);
+      this.Click += new EventHandler (fire);
+    }
+
+    private void fire(object sender, System.EventArgs e)
+    {
+        Invalidate();
+    }
+
+    private void f1_paint(object sender, PaintEventArgs e)
+    {
+      Graphics g = e.Graphics;
+Console.WriteLine (g.ClipBounds);
+      g.FillEllipse(Brushes.Red, 20, 20, 200, 200);
+      g.TranslateTransform(120, 120, MatrixOrder.Append);
+    }
+  }
+}
+
+As Sebastien guessed, seems like that MS.NET resets the transform and
+thus g.ClipBounds shows always the same rectangle in f1_paint().
+
+Attaching a fix.


More information about the mono-bugs mailing list