[Mono-bugs] [Bug 78563][Cos] New - TextBoxBase: backcolor behavior differences

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jun 1 08:25: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 atsushi at ximian.com.

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

--- shadow/78563	2006-06-01 08:25:54.000000000 -0400
+++ shadow/78563.tmp.28999	2006-06-01 08:25:54.000000000 -0400
@@ -0,0 +1,110 @@
+Bug#: 78563
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Cosmetic
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: TextBoxBase: backcolor behavior differences
+
+Our TextBoxBase premises that the default BackColor will never be set
+explicitly and thus TextBox always draws ReadOnly textbox as default
+Control backcolor.
+
+There are many minor differences between mono, .NET 1.x and .NET 2.0. Here
+I put an example.
+
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+public class Test : Form
+{
+	public static void Main ()
+	{
+		Application.Run (new Test ());
+	}
+
+	public Test ()
+	{
+		TextBox tb1 = new TextBox ();
+		tb1.BackColor = tb1.BackColor;
+		tb1.BackColorChanged += delegate (object o, EventArgs e) {
+			Console.WriteLine (GetHashCode ()); };
+		tb1.ReadOnly = true;
+		TextBox tb2 = new TextBox ();
+		tb2.BackColorChanged += delegate (object o, EventArgs e) {
+			Console.WriteLine (GetHashCode ()); };
+		tb2.Location = new Point (0, 150);
+		tb2.ReadOnly = true;
+		Controls.Add (tb1);
+		Controls.Add (tb2);
+
+		RichTextBox tb3 = new RichTextBox ();
+		tb3.Location = new Point (100, 0);
+		tb3.BackColor = tb3.BackColor;
+		tb3.BackColorChanged += delegate (object o, EventArgs e) {
+			Console.WriteLine (GetHashCode ()); };
+		tb3.ReadOnly = true;
+		RichTextBox tb4 = new RichTextBox ();
+		tb4.Location = new Point (100, 150);
+		tb4.BackColorChanged += delegate (object o, EventArgs e) {
+			Console.WriteLine (GetHashCode ()); };
+		tb4.ReadOnly = true;
+		Controls.Add (tb3);
+		Controls.Add (tb4);
+
+		Button b = new Button ();
+		b.Location = new Point (80, 120);
+		b.Click += delegate (object o, EventArgs e) {
+			tb1.ResetBackColor ();
+			tb2.ResetBackColor ();
+			tb3.ResetBackColor ();
+			tb4.ResetBackColor ();
+		};
+		Controls.Add (b);
+	}
+}
+
+
+Steps to reproduce the problem:
+1. compile and run the example
+2. push the central button to ResetBackColor().
+
+Actual Results:
+
+All text boxes are drawn as gray.
+
+Expected Results:
+
+in .NET 1.1, The colors would be:
+
+white | white
+------+-------
+gray  | white
+
+in .NET 2.0, The colors would be:
+
+white | white
+------+-------
+gray  | gray
+
+
+when you push the button, all text boxes turns to gray in 2.0 (which rather
+looks like a bug though).
+
+Additional Information:
+
+A fix being attached.
+
+I need this change to fix PropertyGrid back color.


More information about the mono-bugs mailing list