Author: toshok
Date: 2006-08-10 14:18:21 -0400 (Thu, 10 Aug 2006)
New Revision: 63614

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs
Log:
2006-08-10  Chris Toshok  <[EMAIL PROTECTED]>

        * ToolBar.cs, ToolBarButton.cs: fix the redraw-on-highlight
        flickering in flat mode (and most of the flickering in general) by
        only invalidating the button border (and not the entire rectangle)
        when the state changes.  A couple of cases still flicker:
        ToggleButtons, and the dropdown arrow case when the user mouse
        ups.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-08-10 18:11:34 UTC (rev 63613)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-08-10 18:18:21 UTC (rev 63614)
@@ -1,3 +1,12 @@
+2006-08-10  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * ToolBar.cs, ToolBarButton.cs: fix the redraw-on-highlight
+       flickering in flat mode (and most of the flickering in general) by
+       only invalidating the button border (and not the entire rectangle)
+       when the state changes.  A couple of cases still flicker:
+       ToggleButtons, and the dropdown arrow case when the user mouse
+       ups.
+
 2006-08-10  Alexander Olk  <[EMAIL PROTECTED]>
 
        * X11Keyboard.cs: Fixed handling of the Del key on the cursorblock

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs       
2006-08-10 18:11:34 UTC (rev 63613)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs       
2006-08-10 18:18:21 UTC (rev 63614)
@@ -444,7 +444,7 @@
                        }
                        e.Button.pressed = false;
 
-                       Invalidate (e.Button.Rectangle);
+                       e.Button.InvalidateBorder ();
 
                        if (ButtonClick != null)
                                ButtonClick (this, e);
@@ -614,7 +614,7 @@
                                        }
                                        button.pressed = true;
                                        button.inside = true;
-                                       Invalidate (button.Rectangle);
+                                       button.InvalidateBorder ();
                                        break;
                                }
                        }
@@ -647,7 +647,7 @@
                                                OnButtonClick (new 
ToolBarButtonClickEventArgs (button));
                                } else if (button.pressed) {
                                        button.pressed = false;
-                                       Invalidate (button.Rectangle);
+                                       button.InvalidateBorder ();
                                }
                        }
                }
@@ -659,7 +659,6 @@
 
                        if (current_button.Hilight) {
                                current_button.Hilight = false;
-                               Invalidate (current_button.Rectangle);
                        }
                        current_button = null;
                }
@@ -679,7 +678,6 @@
                                            (button.inside != 
button.Rectangle.Contains (loc))) {
                                                button.inside = 
button.Rectangle.Contains (loc);
                                                button.Hilight = false;
-                                               Invalidate (button.Rectangle);
                                                break;
                                        }
                                }
@@ -690,7 +688,6 @@
                                        if (current_button.Hilight || 
current_button.Pushed)
                                                return;
                                        current_button.Hilight = true;
-                                       Invalidate (current_button.Rectangle);
                                }
                                else {
                                        foreach (ToolBarButton button in 
buttons) {
@@ -699,11 +696,9 @@
                                                        if 
(current_button.Hilight || current_button.Pushed)
                                                                continue;
                                                        current_button.Hilight 
= true;
-                                                       Invalidate 
(current_button.Rectangle);
                                                }
                                                else if (button.Hilight) {
                                                        button.Hilight = false;
-                                                       Invalidate 
(button.Rectangle);
                                                }
                                        }
                                }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs 
2006-08-10 18:11:34 UTC (rev 63613)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs 
2006-08-10 18:18:21 UTC (rev 63614)
@@ -74,7 +74,7 @@
                                        return;
 
                                hilight = value;
-                               Invalidate ();
+                               InvalidateBorder ();
                        }
                }
 
@@ -372,6 +372,18 @@
                        return size;
                }
 
+               internal void InvalidateBorder ()
+               {
+                       if (Rectangle == Rectangle.Empty)
+                               return;
+
+                       /* invalidate the four sides of our border */
+                       Parent.Invalidate (new Rectangle (Rectangle.X - 2, 
Rectangle.Y - 2, Rectangle.Width + 4, 4));
+                       Parent.Invalidate (new Rectangle (Rectangle.X - 2, 
Rectangle.Y - 2, 4, Rectangle.Height + 4));
+                       Parent.Invalidate (new Rectangle (Rectangle.X - 2, 
Rectangle.Y + Rectangle.Height - 2, Rectangle.Width + 4, 4));
+                       Parent.Invalidate (new Rectangle (Rectangle.X + 
Rectangle.Width - 2, Rectangle.Y - 2, 4, Rectangle.Height + 4));
+               }
+
                void Invalidate ()
                {
                        if (Parent != null)

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

Reply via email to