[Mono-bugs] [Bug 78756][Nor] Changed - Refresh problem during a Thread.Sleep
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Jul 5 10:31:39 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 13:53:55.000000000 -0400
+++ shadow/78756.tmp.10936 2006-07-05 10:31:39.000000000 -0400
@@ -4,20 +4,20 @@
OS: unknown
OS Details:
Status: NEW
Resolution:
Severity: Unknown
Priority: Normal
-Component: Sys.Drawing.
+Component: Windows.Forms
AssignedTo: peter at novonyx.com
ReportedBy: unserkonig at gmail.com
QAContact: mono-bugs at ximian.com
TargetMilestone: ---
URL:
Cc:
-Summary: Graphics: DrawString doesn't the string if a call to FillRectangle is next.
+Summary: Refresh problem during a Thread.Sleep
This is a small sample from a Windows.Forms book, which shows a button,
and when clicked, a text appears for a fraction of a second. This example
calls Form.CreateGraphics (), Graphics.DrawString () and
Graphics.FillRectangle.
@@ -92,6 +92,58 @@
------- Additional Comments From unserkonig at gmail.com 2006-07-04 13:53 -------
I'm sorry, but I'm having some connection problems with my internet
service provider, and right now I can't post any text with more than
30 lines to bugzilla (this should change as I'm going to change of
provider).
+
+------- Additional Comments From sebastien at ximian.com 2006-07-05 10:31 -------
+It seems to be a SWF refresh problem as this code (changing
+button.Text) provoke an update and works as expected.
+
+Updated Summary and moved back to MWF.
+
+
+// mcs 78756.cs -r:System.Windows.Forms.dll -r:System.Drawing.dll
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Threading;
+
+public class TestForm : Form {
+
+ private Button button;
+
+ public TestForm ()
+ {
+ button = new Button ();
+ button.Parent = this;
+ button.Location = new Point (50, 50);
+ 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);
+ // This allows the text to appear in the form
+ button.Text = "wait";
+ Thread.Sleep (1000 * 10);
+ // 'Clean' form
+ graphics.FillRectangle (new SolidBrush (BackColor),
+new RectangleF (point, graphics.MeasureString (str, Font)));
+ button.Text = "Click me";
+ graphics.Dispose ();
+ }
+
+ static void Main ()
+ {
+ Application.Run (new TestForm ());
+ }
+}
+
More information about the mono-bugs
mailing list