Author: jpobst
Date: 2007-07-12 09:50:03 -0400 (Thu, 12 Jul 2007)
New Revision: 81871

Modified:
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Theming/Default/ButtonPainter.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Theming/Default/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatButtonAppearance.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
Log:
2007-07-12  Jonathan Pobst  <[EMAIL PROTECTED]>

        * FlatButtonAppearance.cs: Throw NotSupportedException for a
        Transparent BorderColor.

2007-07-12  Jonathan Pobst  <[EMAIL PROTECTED]>

        * ButtonPainter.cs: For Flat button, if BorderSize is 0, don't
        draw the rectangle.  Setting the pen's width to 1 isn't good
        enough, it still draws the border.  [Fixes bug #82081]

2007-07-12  Jonathan Pobst  <[EMAIL PROTECTED]>

        * ButtonTest.cs: Add test showing a NSE if Flat BorderSize is 0.

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-07-12 13:22:35 UTC (rev 81870)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-07-12 13:50:03 UTC (rev 81871)
@@ -1,3 +1,8 @@
+2007-07-12  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * FlatButtonAppearance.cs: Throw NotSupportedException for a
+       Transparent BorderColor.
+
 2007-07-12  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
 
        * DataGridView.cs, TextControl.cs, ProgressBar.cs, PrintDialog.cs,

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatButtonAppearance.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatButtonAppearance.cs
  2007-07-12 13:22:35 UTC (rev 81870)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatButtonAppearance.cs
  2007-07-12 13:50:03 UTC (rev 81871)
@@ -63,6 +63,9 @@
                                if(borderColor == value)
                                        return;
 
+                               if (value == Color.Transparent)
+                                       throw new NotSupportedException 
("Cannot have a Transparent border.");
+                                       
                                borderColor = value;
                                
                                if(owner != null)

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Theming/Default/ButtonPainter.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Theming/Default/ButtonPainter.cs
 2007-07-12 13:22:35 UTC (rev 81870)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Theming/Default/ButtonPainter.cs
 2007-07-12 13:50:03 UTC (rev 81871)
@@ -126,11 +126,13 @@
                                pen = is_themecolor ? 
SystemPens.ControlDarkDark : ResPool.GetSizedPen (cpcolor.DarkDark, 
appearance.BorderSize);
                        else
                                pen = ResPool.GetSizedPen 
(appearance.BorderColor, appearance.BorderSize);
+
+                               bounds.Width -= 1;
+                               bounds.Height -= 1;
                                
-                       bounds.Width -= 1;
-                       bounds.Height -= 1;
-                       g.DrawRectangle (pen, bounds);
-
+                       if (appearance.BorderSize > 0)
+                               g.DrawRectangle (pen, bounds);
+                       
                        if (state == ButtonThemeState.Default || state == 
ButtonThemeState.Pressed) {
                                bounds.Inflate (-1, -1);
                                g.DrawRectangle (pen, bounds);

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Theming/Default/ChangeLog
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Theming/Default/ChangeLog
        2007-07-12 13:22:35 UTC (rev 81870)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Theming/Default/ChangeLog
        2007-07-12 13:50:03 UTC (rev 81871)
@@ -1,3 +1,9 @@
+2007-07-12  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * ButtonPainter.cs: For Flat button, if BorderSize is 0, don't
+       draw the rectangle.  Setting the pen's width to 1 isn't good
+       enough, it still draws the border.  [Fixes bug #82081]
+
 2007-07-03  Jonathan Pobst  <[EMAIL PROTECTED]>
 
        * ToolStripPainter.cs: Added. This is where we paint toolstrips

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs   
    2007-07-12 13:22:35 UTC (rev 81870)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs   
    2007-07-12 13:50:03 UTC (rev 81871)
@@ -78,6 +78,16 @@
                }
 
                [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void FlatButtonAppearanceBorderColor ()
+               {
+                       Button B1 = new Button ();
+                       FlatButtonAppearance flatApp = B1.FlatAppearance;
+
+                       flatApp.BorderColor = Color.Transparent;
+               }
+
+               [Test]
                public void BehaviorAutoSize ()
                {
                        if (TestHelper.RunningOnUnix)

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-07-12 13:22:35 UTC (rev 81870)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-07-12 13:50:03 UTC (rev 81871)
@@ -1,3 +1,7 @@
+2007-07-12  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * ButtonTest.cs: Add test showing a NSE if Flat BorderSize is 0.
+
 2007-07-09  Jonathan Pobst  <[EMAIL PROTECTED]>
 
        * MessageTest.cs: Add tests for op_Equality and op_Inequality.

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to