2008-12-06 Ivan N. Zlatev <contact@i-nz.net>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / ThemeNice.cs
index 36521c614bba3ef0dd928c52d63ff89d0c44694e..6e6ee4b9d75e22f9ec30b5a1a916e8231c77ff21 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-// Copyright (c) 2004-2005 Novell, Inc.
+// Copyright (c) 2006 Alexander Olk
 //
 // Authors:
-//     Alexander Olk, xenomorph2@onlinehome.de
+//     Alexander Olk, alex.olk@googlemail.com
 //
 //     based on ThemeWin32Classic
 //
@@ -57,13 +57,10 @@ namespace System.Windows.Forms
                static Blend NormalBlend;
                static Blend FlatBlend;
                
-               int platform = (int) Environment.OSVersion.Platform;
-               
                #region Principal Theme Methods
                public ThemeNice( )
                {
                        ColorControl = NiceBackColor;
-                       always_draw_hotkeys = true;
                        
                        FlatBlend = new Blend ();
                        FlatBlend.Factors = new float []{0.0f, 0.992f, 1.0f};
@@ -81,7 +78,7 @@ namespace System.Windows.Forms
                
                public override Color DefaultWindowBackColor
                {
-                       get { return NiceBackColor; }                   
+                       get { return NiceBackColor; }
                }
                
                public override Color ColorControl {
@@ -113,27 +110,27 @@ namespace System.Windows.Forms
                public override Image Images(UIIcon index, int size) {
                        switch (index) {
                        case UIIcon.PlacesRecentDocuments:
-                               if ((platform == 4) || (platform == 128))
+                               if (XplatUI.RunningOnUnix)
                                        return MimeIconEngine.GetIconForMimeTypeAndSize( "recently/recently", new Size(size, size) );
                                else
                                        return base.Images (UIIcon.PlacesRecentDocuments, size);
                        case UIIcon.PlacesDesktop:
-                               if ((platform == 4) || (platform == 128))
+                               if (XplatUI.RunningOnUnix)
                                        return MimeIconEngine.GetIconForMimeTypeAndSize( "desktop/desktop", new Size(size, size) );
                                else
                                        return base.Images (UIIcon.PlacesDesktop, size);
                        case UIIcon.PlacesPersonal:
-                               if ((platform == 4) || (platform == 128))
+                               if (XplatUI.RunningOnUnix)
                                        return MimeIconEngine.GetIconForMimeTypeAndSize( "directory/home", new Size(size, size) );
                                else
                                        return base.Images (UIIcon.PlacesPersonal, size);
                        case UIIcon.PlacesMyComputer:
-                               if ((platform == 4) || (platform == 128))
+                               if (XplatUI.RunningOnUnix)
                                        return MimeIconEngine.GetIconForMimeTypeAndSize( "workplace/workplace", new Size(size, size) );
                                else
                                        return base.Images (UIIcon.PlacesMyComputer, size);
                        case UIIcon.PlacesMyNetwork:
-                               if ((platform == 4) || (platform == 128))
+                               if (XplatUI.RunningOnUnix)
                                        return MimeIconEngine.GetIconForMimeTypeAndSize( "network/network", new Size(size, size) );
                                else
                                        return base.Images (UIIcon.PlacesMyNetwork, size);
@@ -146,7 +143,7 @@ namespace System.Windows.Forms
                                
                                // misc Icons
                        case UIIcon.NormalFolder:
-                               if ((platform == 4) || (platform == 128))
+                               if (XplatUI.RunningOnUnix)
                                        return MimeIconEngine.GetIconForMimeTypeAndSize( "inode/directory", new Size(size, size) );
                                else
                                        return base.Images (UIIcon.NormalFolder, size);
@@ -203,10 +200,10 @@ namespace System.Windows.Forms
                        // Fill button with a nice linear gradient brush
                        Rectangle lgbRectangle = Rectangle.Inflate (buttonRectangle, -1, -1);
                        
-                       if (button.flat_style != FlatStyle.Popup || ((button.flat_style == FlatStyle.Popup) && button.is_entered)) {
+                       if (button.FlatStyle != FlatStyle.Popup || ((button.FlatStyle == FlatStyle.Popup) && button.is_entered)) {
                                LinearGradientBrush lgbr;
                                if (!button.is_pressed && !check_or_radio_checked) {
-                                       if (button.flat_style == FlatStyle.Flat) {
+                                       if (button.FlatStyle == FlatStyle.Flat) {
                                                lgbr = new LinearGradientBrush (new Point (0, 0), new Point (0, height - 1), use_color, first_color);
                                                lgbr.Blend = FlatBlend;
                                        } else {
@@ -272,7 +269,7 @@ namespace System.Windows.Forms
                                CalcMenuBarSize (dc, menu, rect.Width);
                        
                        bool keynav = (menu as MainMenu).tracker.Navigating;
-                       HotkeyPrefix hp = always_draw_hotkeys || keynav ? HotkeyPrefix.Show : HotkeyPrefix.Hide;
+                       HotkeyPrefix hp = MenuAccessKeysUnderlined || keynav ? HotkeyPrefix.Show : HotkeyPrefix.Hide;
                        string_format_menu_menubar_text.HotkeyPrefix = hp;
                        string_format_menu_text.HotkeyPrefix = hp;
                        
@@ -318,15 +315,15 @@ namespace System.Windows.Forms
                        if (item.BarBreak) { /* Draw vertical break bar*/
                                Rectangle rect = e.Bounds;
                                rect.Y++;
-                               rect.Width = 3;
-                               rect.Height = item.MenuHeight - 6;
+                               rect.Width = 3;
+                               rect.Height = item.MenuHeight - 6;
                                
                                e.Graphics.DrawLine (ResPool.GetPen (ColorControlDark),
-                                                    rect.X, rect.Y , rect.X, rect.Y + rect.Height);
+                                       rect.X, rect.Y , rect.X, rect.Y + rect.Height);
                                
                                e.Graphics.DrawLine (ResPool.GetPen (ColorControlLight),
-                                                    rect.X + 1, rect.Y , rect.X +1, rect.Y + rect.Height);
-                       }                       
+                                       rect.X + 1, rect.Y , rect.X +1, rect.Y + rect.Height);
+                       }
                        
                        Color color_text = ColorMenuText;
                        Color color_back = NiceBackColor;
@@ -347,8 +344,8 @@ namespace System.Windows.Forms
                        
                        if (item.Enabled) {
                                e.Graphics.DrawString (item.Text, e.Font,
-                                                      ResPool.GetSolidBrush (color_text),
-                                                      rect_text, string_format);
+                                       ResPool.GetSolidBrush (color_text),
+                                       rect_text, string_format);
                                
                                if (!item.MenuBar && item.Shortcut != Shortcut.None && item.ShowShortcut) {
                                        string str = item.GetShortCutText ();
@@ -357,12 +354,12 @@ namespace System.Windows.Forms
                                        rect.Width -= item.XTab;
                                        
                                        e.Graphics.DrawString (str, e.Font, ResPool.GetSolidBrush (color_text),
-                                                              rect, string_format_menu_shortcut);
+                                               rect, string_format_menu_shortcut);
                                }
                                
                        } else {
                                ControlPaint.DrawStringDisabled (e.Graphics, item.Text, e.Font, 
-                                                                Color.Black, rect_text, string_format);
+                                       Color.Black, rect_text, string_format);
                        }
                        
                        /* Draw arrow */
@@ -470,135 +467,6 @@ namespace System.Windows.Forms
                        if ( bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith( thumb_pos ) )
                                DrawScrollBarThumb( dc, thumb_pos, bar );
                }
-               
-               protected override void ScrollBar_Vertical_Draw_ThumbMoving_None( int scrollbutton_height, ScrollBar bar, Rectangle clip, Graphics dc )
-               {
-                       Rectangle r = new Rectangle( 0,
-                                                   scrollbutton_height, bar.ClientRectangle.Width, bar.ClientRectangle.Height - ( scrollbutton_height * 2 ) );
-                       Rectangle intersect = Rectangle.Intersect( clip, r );
-                       
-                       if ( intersect != Rectangle.Empty  )
-                       {
-                               using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( r. Width - 1, 0 ), LightColor, Color.White ) )
-                               {
-                                       lgbr.Blend = FlatBlend;
-                                       dc.FillRectangle( lgbr, intersect );
-                               }
-                       }
-               }
-               
-               protected override void ScrollBar_Vertical_Draw_ThumbMoving_Forward( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
-               {
-                       Rectangle r = new Rectangle( 0,  scrollbutton_height,
-                                                   bar.ClientRectangle.Width, thumb_pos.Y  - scrollbutton_height );
-                       Rectangle intersect = Rectangle.Intersect( clip, r );
-                       
-                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( r. Width - 1, 0 ), LightColor, Color.White ) )
-                       {
-                               lgbr.Blend = FlatBlend;
-                               
-                               if ( intersect != Rectangle.Empty )
-                                       dc.FillRectangle( lgbr, intersect );
-                               
-                               r.X = 0;
-                               r.Y = thumb_pos.Y + thumb_pos.Height;
-                               r.Width = bar.ClientRectangle.Width;
-                               r.Height = bar.ClientRectangle.Height -  ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
-                               
-                               intersect = Rectangle.Intersect( clip, r );
-                               if ( intersect != Rectangle.Empty )
-                                       dc.FillRectangle( lgbr, intersect );
-                       }
-               }
-               
-               protected override void ScrollBar_Vertical_Draw_ThumbMoving_Backwards( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
-               {
-                       Rectangle r = new Rectangle( 0,  scrollbutton_height,
-                                                   bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
-                       Rectangle intersect = Rectangle.Intersect( clip, r );
-                       
-                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( r. Width - 1, 0 ), LightColor, Color.White ) )
-                       {
-                               lgbr.Blend = FlatBlend;
-                               
-                               if ( intersect != Rectangle.Empty )
-                                       dc.FillRectangle( lgbr, intersect );
-                               
-                               r.X = 0;
-                               r.Y = thumb_pos.Y + thumb_pos.Height;
-                               r.Width = bar.ClientRectangle.Width;
-                               r.Height = bar.ClientRectangle.Height -  ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
-                               
-                               intersect = Rectangle.Intersect( clip, r );
-                               if ( intersect != Rectangle.Empty )
-                                       dc.FillRectangle( lgbr, intersect );
-                       }
-               }
-               
-               protected override void ScrollBar_Horizontal_Draw_ThumbMoving_None( int scrollbutton_width, ScrollBar bar, Rectangle clip, Graphics dc )
-               {
-                       Rectangle r = new Rectangle( scrollbutton_width,
-                                                   0, bar.ClientRectangle.Width - ( scrollbutton_width * 2 ), bar.ClientRectangle.Height );
-                       Rectangle intersect = Rectangle.Intersect( clip, r );
-                       
-                       if ( intersect != Rectangle.Empty )
-                       {
-                               using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, r.Height - 1 ), LightColor, Color.White ) )
-                               {
-                                       lgbr.Blend = FlatBlend;
-                                       
-                                       dc.FillRectangle( lgbr, intersect );
-                               }
-                       }
-               }
-               
-               protected override void ScrollBar_Horizontal_Draw_ThumbMoving_Forward( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc )
-               {
-                       Rectangle r = new Rectangle( scrollbutton_width,  0,
-                                                   thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
-                       Rectangle intersect = Rectangle.Intersect( clip, r );
-                       
-                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, r.Height - 1 ), LightColor, Color.White ) )
-                       {
-                               lgbr.Blend = FlatBlend;
-                               
-                               if ( intersect != Rectangle.Empty )
-                                       dc.FillRectangle( lgbr, intersect );
-                               
-                               r.X = thumb_pos.X + thumb_pos.Width;
-                               r.Y = 0;
-                               r.Width = bar.ClientRectangle.Width -  ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
-                               r.Height = bar.ClientRectangle.Height;
-                               
-                               intersect = Rectangle.Intersect( clip, r );
-                               if ( intersect != Rectangle.Empty )
-                                       dc.FillRectangle( lgbr, intersect );
-                       }
-               }
-               
-               protected override void ScrollBar_Horizontal_Draw_ThumbMoving_Backwards( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc )
-               {
-                       Rectangle r = new Rectangle( scrollbutton_width,  0,
-                                                   thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
-                       Rectangle intersect = Rectangle.Intersect( clip, r );
-                       
-                       using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, r.Height - 1 ), LightColor, Color.White ) )
-                       {
-                               lgbr.Blend = FlatBlend;
-                               
-                               if ( intersect != Rectangle.Empty )
-                                       dc.FillRectangle( lgbr, intersect );
-                               
-                               r.X = thumb_pos.X + thumb_pos.Width;
-                               r.Y = 0;
-                               r.Width = bar.ClientRectangle.Width -  ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
-                               r.Height = bar.ClientRectangle.Height;
-                               
-                               intersect = Rectangle.Intersect( clip, r );
-                               if ( intersect != Rectangle.Empty )
-                                       dc.FillRectangle( lgbr, intersect );
-                       }
-               }
                #endregion      // ScrollBar
                
                #region StatusBar
@@ -663,7 +531,7 @@ namespace System.Windows.Forms
                {
                        // Do we need to fill the back color? It can't be changed...
                        dc.FillRectangle( ResPool.GetSolidBrush( NiceBackColor ), area );
-                       Rectangle panel_rect = GetTabPanelRectExt( tab );
+                       Rectangle panel_rect = TabControlGetPanelRect( tab );
                        
                        if ( tab.Appearance == TabAppearance.Normal )
                        {
@@ -715,14 +583,14 @@ namespace System.Windows.Forms
                        
                        if ( tab.ShowSlider )
                        {
-                               Rectangle right = GetTabControlRightScrollRect( tab );
-                               Rectangle left = GetTabControlLeftScrollRect( tab );
+                               Rectangle right = TabControlGetRightScrollRect( tab );
+                               Rectangle left = TabControlGetLeftScrollRect( tab );
                                CPDrawScrollButton( dc, right, ScrollButton.Right, tab.RightSliderState );
                                CPDrawScrollButton( dc, left, ScrollButton.Left, tab.LeftSliderState );
                        }
                }
                
-               protected override int DrawTab( Graphics dc, TabPage page, TabControl tab, Rectangle bounds, bool is_selected )
+               protected virtual int DrawTab( Graphics dc, TabPage page, TabControl tab, Rectangle bounds, bool is_selected )
                {
                        int FlatButtonSpacing = 8;
                        Rectangle interior;
@@ -755,7 +623,6 @@ namespace System.Windows.Forms
                                
                                interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 4, bounds.Height - 4 );
                                
-                                
                                StringFormat string_format = new StringFormat( );
                                string_format.Alignment = StringAlignment.Center;
                                string_format.LineAlignment = StringAlignment.Center;
@@ -950,10 +817,6 @@ namespace System.Windows.Forms
                }
                
                #region ToolBar
-               public override bool ToolBarInvalidateEntireButton {
-                       get { return true; }
-               }
-
                public  override void DrawToolBar (Graphics dc, Rectangle clip_rectangle, ToolBar control) 
                {
                        StringFormat format = new StringFormat ();
@@ -966,65 +829,65 @@ namespace System.Windows.Forms
                        
                        dc.FillRectangle (ResPool.GetSolidBrush( NiceBackColor ), clip_rectangle);
                        
-                       foreach (ToolBarButton button in control.Buttons)
-                               if (button.Visible && clip_rectangle.IntersectsWith (button.Rectangle))
-                                       DrawToolBarButton (dc, control, button, format);
+                       foreach (ToolBarItem item in control.items)
+                               if (item.Button.Visible && clip_rectangle.IntersectsWith (item.Rectangle))
+                                       DrawToolBarButton (dc, control, item, format);
                        
                        format.Dispose ();
                }
                
-               protected override void DrawToolBarButton (Graphics dc, ToolBar control, ToolBarButton button, StringFormat format)
+               protected override void DrawToolBarButton (Graphics dc, ToolBar control, ToolBarItem item, StringFormat format)
                {
                        bool is_flat = control.Appearance == ToolBarAppearance.Flat;
                        
-                       if (button.Style != ToolBarButtonStyle.Separator)
-                               DoDrawToolBarButton (dc, button, is_flat);
+                       if (item.Button.Style != ToolBarButtonStyle.Separator)
+                               DoDrawToolBarButton (dc, item, is_flat);
                        
-                       switch (button.Style) {
+                       switch (item.Button.Style) {
                        case ToolBarButtonStyle.DropDownButton:
                                if (control.DropDownArrows)
-                                       DrawToolBarDropDownArrow (dc, button, is_flat);
-                               DrawToolBarButtonContents (dc, control, button, format);
+                                       DrawToolBarDropDownArrow (dc, item, is_flat);
+                               DrawToolBarButtonContents (dc, control, item, format);
                                break;
                                
                        case ToolBarButtonStyle.Separator:
                                if (is_flat)
-                                       DrawToolBarSeparator (dc, button);
+                                       DrawToolBarSeparator (dc, item);
                                break;
                                
                        case ToolBarButtonStyle.ToggleButton:
                        default:
-                               DrawToolBarButtonContents (dc, control, button, format);
+                               DrawToolBarButtonContents (dc, control, item, format);
                                break;
                        }
                }
                
                const Border3DSide all_sides = Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom;
                
-               void DoDrawToolBarButton (Graphics dc, ToolBarButton button, bool is_flat)
+               void DoDrawToolBarButton (Graphics dc, ToolBarItem item, bool is_flat)
                {
                        Color use_color = NormalColor;
                        Color first_color = Color.White;
                        
                        if (is_flat) {
-                               if (button.Pushed || button.Pressed) {
+                               if (item.Button.Pushed || item.Pressed) {
                                        first_color = PressedColor;
                                        use_color = MouseOverColor;
                                } else
-                               if (button.Hilight)
+                               if (item.Hilight)
                                        use_color = MouseOverColor;
                                else
                                        return;
                        } else {
-                               if (button.Pushed || button.Pressed) {
+                               if (item.Button.Pushed || item.Pressed) {
                                        first_color = PressedColor;
                                        use_color = MouseOverColor;
                                } else
-                               if (button.Hilight)
+                               if (item.Hilight)
                                        use_color = MouseOverColor;
                        }
                        
-                       Rectangle buttonRectangle = button.Rectangle;
+                       Rectangle buttonRectangle = item.Rectangle;
                        
                        Rectangle lgbRectangle = Rectangle.Inflate (buttonRectangle, -1, -1);
                        
@@ -1036,27 +899,27 @@ namespace System.Windows.Forms
                        Internal_DrawButton (dc, buttonRectangle, BorderColor);
                }
                
-               protected override void DrawToolBarSeparator (Graphics dc, ToolBarButton button)
+               protected override void DrawToolBarSeparator (Graphics dc, ToolBarItem item)
                {
-                       Rectangle area = button.Rectangle;
+                       Rectangle area = item.Rectangle;
                        int offset = (int) ResPool.GetPen (ColorControl).Width + 1;
                        dc.DrawLine (ResPool.GetPen (ColorControlDark), area.X + 1, area.Y, area.X + 1, area.Bottom);
                        dc.DrawLine (ResPool.GetPen (ColorControlLight), area.X + offset, area.Y, area.X + offset, area.Bottom);
                }
                
-               protected override void DrawToolBarDropDownArrow (Graphics dc, ToolBarButton button, bool is_flat)
+               protected override void DrawToolBarDropDownArrow (Graphics dc, ToolBarItem item, bool is_flat)
                {
-                       Rectangle rect = button.Rectangle;
-                       rect.X = button.Rectangle.Right - ToolBarDropDownWidth;
+                       Rectangle rect = item.Rectangle;
+                       rect.X = item.Rectangle.Right - ToolBarDropDownWidth;
                        rect.Width = ToolBarDropDownWidth;
                        
-                       if (button.dd_pressed) {
+                       if (item.DDPressed) {
                                CPDrawBorder3D (dc, rect, Border3DStyle.SunkenOuter, all_sides);
                                CPDrawBorder3D (dc, rect, Border3DStyle.SunkenInner, Border3DSide.Bottom | Border3DSide.Right);
-                       } else if (button.Pushed || button.Pressed)
+                       } else if (item.Button.Pushed || item.Pressed)
                                CPDrawBorder3D (dc, rect, Border3DStyle.Sunken, all_sides);
                        else if (is_flat) {
-                               if (button.Hilight)
+                               if (item.Hilight)
                                        CPDrawBorder3D (dc, rect, Border3DStyle.RaisedOuter, all_sides);
                        } else
                                CPDrawBorder3D (dc, rect, Border3DStyle.Raised, all_sides);
@@ -1072,21 +935,21 @@ namespace System.Windows.Forms
                        dc.FillPolygon (SystemBrushes.ControlText, vertices);
                }
                
-               protected override void DrawToolBarButtonContents (Graphics dc, ToolBar control, ToolBarButton button, StringFormat format)
+               protected override void DrawToolBarButtonContents (Graphics dc, ToolBar control, ToolBarItem item, StringFormat format)
                {
-                       if (button.Image != null) {
-                               int x = button.ImageRectangle.X + ToolBarImageGripWidth;
-                               int y = button.ImageRectangle.Y + ToolBarImageGripWidth;
-                               if (button.Enabled)
-                                       dc.DrawImage (button.Image, x, y);
+                       if (item.Button.Image != null) {
+                               int x = item.ImageRectangle.X + ToolBarImageGripWidth;
+                               int y = item.ImageRectangle.Y + ToolBarImageGripWidth;
+                               if (item.Button.Enabled)
+                                       dc.DrawImage (item.Button.Image, x, y);
                                else 
-                                       CPDrawImageDisabled (dc, button.Image, x, y, ColorControl);
+                                       CPDrawImageDisabled (dc, item.Button.Image, x, y, ColorControl);
                        }
                        
-                       if (button.Enabled)
-                               dc.DrawString (button.Text, control.Font, ResPool.GetSolidBrush (ColorControlText), button.TextRectangle, format);
+                       if (item.Button.Enabled)
+                               dc.DrawString (item.Button.Text, control.Font, ResPool.GetSolidBrush (ColorControlText), item.TextRectangle, format);
                        else
-                               CPDrawStringDisabled (dc, button.Text, control.Font, ColorControlLight, button.TextRectangle, format);
+                               CPDrawStringDisabled (dc, item.Button.Text, control.Font, ColorControlLight, item.TextRectangle, format);
                }
 
                #endregion      // ToolBar
@@ -1095,7 +958,7 @@ namespace System.Windows.Forms
 //                     CPDrawBorder3D(graphics, rectangle, style, sides, ColorControl);
 //             }
                
-               protected override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color)
+               public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color)
                {
                        Pen             penTopLeft;
                        Pen             penTopLeftInner;
@@ -1599,9 +1462,8 @@ namespace System.Windows.Forms
                                CPDrawStringDisabled (dc, box.Text, box.Font, box.ForeColor, 
                                                      new RectangleF (10, 0, width,  box.Font.Height), text_format);
                        }
-                       text_format.Dispose (); 
+                       text_format.Dispose ();
                }
                #endregion
        } //class
 }
-