[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
Wed May 17 22:07:52 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-17 17:47:00.000000000 -0400
+++ shadow/77734.tmp.10620	2006-05-17 22:07:52.000000000 -0400
@@ -174,6 +174,50 @@
 'graphics != NULL' failed
 
 So I did a little change in the original test case to see if the same
 Graphics was being reused - and it's not (a new instance is used each
 time). This means anyone disposing it will break it's app under Mono,
 but will execute correctly under MS runtime.
+
+------- Additional Comments From atsushi at ximian.com  2006-05-17 22:07 -------
+Oh, that's a good catch. Yesterday I was trying to find out why MS.NET
+shows "simple" coordinates on the console output from my simple repro
+above (it is rather for fixing bug #78287).
+
+The example below shows that PaintEventArgs has different
+e.ClipRectangle than e.Graphics.ClipBounds on Mono (it might be
+different on .NET too but I couldn't find a case). It might be related
+to the fact (well, I haven't verified yet) that it creates new
+Graphics instance every time.
+
+--------
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+public class Test : Form
+{
+        public static void Main (string [] args)
+        {
+                Bitmap bmp = new Bitmap (100, 100);
+                Graphics g = Graphics.FromImage (bmp);
+                Console.WriteLine (g.ClipBounds);
+
+                Application.Run (new Test ());
+        }
+
+        public Test ()
+        {
+                Button b = new Button ();
+                Controls.Add (b);
+                b.Paint += delegate (object o, PaintEventArgs e) {
+                        Graphics g = CreateGraphics ();
+                        Console.WriteLine (g.ClipBounds);
+                        g = b.CreateGraphics ();
+                        Console.WriteLine (g.ClipBounds);
+                        g = e.Graphics;
+                        Console.WriteLine (g.ClipBounds);
+                        Console.WriteLine (e.ClipRectangle);
+                };
+        }
+}
+


More information about the mono-bugs mailing list