* TextBox.cs: Don't explicitly set our background colors.
authorJackson Harper <jackson@novell.com>
Fri, 9 Mar 2007 22:40:33 +0000 (22:40 -0000)
committerJackson Harper <jackson@novell.com>
Fri, 9 Mar 2007 22:40:33 +0000 (22:40 -0000)
        * TextControl.cs:
        * TextBoxBase.cs: Draw readonly text.

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

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs

index 00b1695ca664f9e20a00d6793afd440be2b3c229..ff6db391978fd9842d3e591e06ce802d7e30333a 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-09  Jackson Harper  <jackson@ximian.com>
+
+       * TextBox.cs: Don't explicitly set our background colors.
+       * TextControl.cs:
+       * TextBoxBase.cs: Draw readonly text.
+       
 2007-03-09  Jackson Harper  <jackson@ximian.com>
 
        * TextBoxBase.cs: Don't set the forecolor until the handle is
index 58eac4084814d8b18732e5ba13f9536d8ebee669..d31a95f7f5e433b154cf00e6819a385b7439222e 100644 (file)
@@ -62,8 +62,6 @@ namespace System.Windows.Forms {
                        scrollbars = RichTextBoxScrollBars.None;
                        alignment = HorizontalAlignment.Left;
                        this.LostFocus +=new EventHandler(TextBox_LostFocus);
-                       this.BackColor = ThemeEngine.Current.ColorWindow;
-                       this.ForeColor = ThemeEngine.Current.ColorWindowText;
 
                        SetStyle (ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false);
                        SetStyle (ControlStyles.FixedHeight, true);
index 7f8ce10b383f600d1e7f1ab252ef874cb7766b2e..44d1badc0a809d0e2ff46457b850840feef0b6bd 100644 (file)
@@ -234,11 +234,7 @@ namespace System.Windows.Forms {
                                return base.BackColor;
                        }
                        set {
-                               if (value != ThemeEngine.Current.ColorWindow) {
-                                       backcolor_set = true;
-                               } else {
-                                       backcolor_set = false;
-                               }
+                               backcolor_set = true;
                                base.BackColor = value;
                        }
                }
@@ -284,7 +280,7 @@ namespace System.Windows.Forms {
                                // textdocument until the handle is created,
                                // and forecolor is actually a property of the
                                // textdocument.
-                               if (this is TextBox && !IsHandleCreated)
+                               if (this is TextBox && read_only && !backcolor_set)
                                        return;
                                base.ForeColor = value;
                        }
index 1baf63e1685708c414ff96b46de7b96d70e708a5..7adfb1a3951f2f3ae3bb4e1a19f95daec74dd6bc 100644 (file)
@@ -1900,6 +1900,7 @@ namespace System.Windows.Forms {
                        Brush tag_brush;
                        Brush current_brush;
                        Brush disabled_brush;
+                       Brush readonly_brush;
                        Brush hilight;
                        Brush hilight_text;
 
@@ -1929,6 +1930,7 @@ namespace System.Windows.Forms {
                        #endif
 
                        disabled_brush = ThemeEngine.Current.ResPool.GetSolidBrush(ThemeEngine.Current.ColorGrayText);
+                       readonly_brush = ThemeEngine.Current.ResPool.GetSolidBrush (ThemeEngine.Current.ColorControlText);
                        hilight = ThemeEngine.Current.ResPool.GetSolidBrush(ThemeEngine.Current.ColorHighlight);
                        hilight_text = ThemeEngine.Current.ResPool.GetSolidBrush(ThemeEngine.Current.ColorHighlightText);
 
@@ -2008,7 +2010,7 @@ namespace System.Windows.Forms {
 
                                        tag_brush = tag.color;
                                        current_brush = tag_brush;
-                                       
+
                                        if (!owner.is_enabled) {
                                                Color a = ((SolidBrush) tag.color).Color;
                                                Color b = ThemeEngine.Current.ColorWindowText;
@@ -2016,6 +2018,8 @@ namespace System.Windows.Forms {
                                                if ((a.R == b.R) && (a.G == b.G) && (a.B == b.B)) {
                                                        tag_brush = disabled_brush;
                                                }
+                                       } else if (owner.read_only && !owner.backcolor_set) {
+                                               tag_brush = readonly_brush;
                                        }
 
                                        int tag_pos = tag.start;
@@ -2027,10 +2031,10 @@ namespace System.Windows.Forms {
                                                        current_brush = hilight_text;
                                                        tag_pos = Math.Min (tag.end, line_selection_end);
                                                } else if (tag_pos < line_selection_start) {
-                                                       current_brush = tag.color;
+                                                       current_brush = tag_brush;
                                                        tag_pos = Math.Min (tag.end, line_selection_start);
                                                } else {
-                                                       current_brush = tag.color;
+                                                       current_brush = tag_brush;
                                                        tag_pos = tag.end;
                                                }