瀏覽代碼

* TextBoxBase.cs: Don't set the forecolor until the handle is
* created.


svn path=/trunk/mcs/; revision=74031

Jackson Harper 19 年之前
父節點
當前提交
49f1ca3f63

+ 4 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -1,3 +1,7 @@
+2007-03-09  Jackson Harper  <[email protected]>
+
+	* TextBoxBase.cs: Don't set the forecolor until the handle is created.
+
 2007-03-09  George Giolfan  <[email protected]>
 
 	* ScrollableControl.cs: Fix mouse wheel scrolling.

+ 7 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs

@@ -279,6 +279,13 @@ namespace System.Windows.Forms {
 				return base.ForeColor;
 			}
 			set {
+				// This is to duplicate a bug on MS (80590)
+				// My guess is that they do not create their
+				// textdocument until the handle is created,
+				// and forecolor is actually a property of the
+				// textdocument.
+				if (this is TextBox && !IsHandleCreated)
+					return;
 				base.ForeColor = value;
 			}
 		}