[Mono-bugs] [Bug 78756][Nor] Changed - Graphics: DrawString doesn't the string if a call to FillRectangle is next.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jul 4 10:47:55 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 sebastien at ximian.com.

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

--- shadow/78756	2006-07-04 04:05:13.000000000 -0400
+++ shadow/78756.tmp.25731	2006-07-04 10:47:55.000000000 -0400
@@ -38,6 +38,53 @@
 
 ------- Additional Comments From unserkonig at gmail.com  2006-07-04 03:47 -------
 Sample code at: http://pastebin.ca/78551
 
 ------- Additional Comments From jackson at ximian.com  2006-07-04 04:05 -------
 -> System.Drawing
+
+------- Additional Comments From sebastien at ximian.com  2006-07-04 10:47 -------
+// please don't use pastebin for sample code
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Threading;
+
+public class Test
+{
+        static void Main ()
+        {
+                TestForm form = new TestForm ();
+                Application.Run (form);
+        }
+}
+
+public class TestForm : Form
+{
+        public TestForm ()
+        {
+                Button button = new Button ();
+                button.Parent = this;
+                button.Location = new Point (5, 5);
+                button.Text = "Click me";
+                button.Click += OnButtonClick;
+        }
+
+        void OnButtonClick (object o, EventArgs args)
+        {
+                Graphics graphics = CreateGraphics ();
+                Point point = new Point (0, 0);
+                string str = "User click.";
+
+                graphics.DrawString (str, Font, new SolidBrush
+(ForeColor),
+                                point);
+                Thread.Sleep (1000 * 10); // This allows the text to
+appear in the form
+                graphics.FillRectangle (new SolidBrush (BackColor),
+                                new RectangleF (point,
+graphics.MeasureString (str, Font))); // 'Clean' form
+                graphics.Dispose ();
+        }
+}
+


More information about the mono-bugs mailing list