svn path=/trunk/mcs/; revision=41147
authorJordi Mas i Hernandez <jordi@mono-cvs.ximian.com>
Thu, 24 Feb 2005 11:23:35 +0000 (11:23 -0000)
committerJordi Mas i Hernandez <jordi@mono-cvs.ximian.com>
Thu, 24 Feb 2005 11:23:35 +0000 (11:23 -0000)
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TrackBar.cs

index 3d2ab724090351bc7bc867dd052e27215775da37..9afc10e402cacc32f23bc974767f35c15917665c 100644 (file)
@@ -1,3 +1,10 @@
+2005-02-24  Jordi Mas i Hernandez <jordi@ximian.com>
+
+       * ThemeWin32Classic.cs: Adds Cliping to TrackBar drawing
+       * ScrollBar.cs: Fixes bug
+       * TrackBar.cs: removes death code, clipping, mimize refreshes, 
+        keyboard navigation enhancements
+
 2005-02-24  Jordi Mas i Hernandez <jordi@ximian.com>
 
        * Control.cs: Call DefWndProc at WM_PAINT only if UserPaint not defined
index e98027ce14da677aba4d25d88ca440997ed064b0..fc4b7330036c1786017f3f7af2afbeff4798ac0a 100644 (file)
@@ -954,7 +954,7 @@ namespace System.Windows.Forms
                        }
                        case Keys.Home:
                        {               
-                               SetValue (0);
+                               SetValue (Minimum);
                                break;
                        }                       
                        case Keys.End:
index 99e0586efa2d6679ac963ee0ee2ea22cac5365d1..df5d6b127a28a5c18d2978c478a3d9bf95062f7e 100644 (file)
@@ -3391,7 +3391,7 @@ namespace System.Windows.Forms
                #endregion      // ToolTip
 
                #region TrackBar
-               private void DrawTrackBar_Vertical (Graphics dc, Rectangle area, TrackBar tb,
+               private void DrawTrackBar_Vertical (Graphics dc, Rectangle clip_rectangle, TrackBar tb,
                        ref Rectangle thumb_pos, ref Rectangle thumb_area,  Brush br_thumb,
                        float ticks, int value_pos, bool mouse_value) {                 
 
@@ -3401,7 +3401,8 @@ namespace System.Windows.Forms
                        float pixel_len;
                        float pixels_betweenticks;
                        const int space_from_right = 8;
-                       const int space_from_left = 8;                  
+                       const int space_from_left = 8;
+                       Rectangle area = tb.ClientRectangle;
                        
                        switch (tb.TickStyle)   {
                        case TickStyle.BottomRight:
@@ -3532,37 +3533,47 @@ namespace System.Windows.Forms
                        }
 
                        pixel_len = thumb_area.Height - 11;
-                       pixels_betweenticks = pixel_len / ticks;                                
+                       pixels_betweenticks = pixel_len / ticks;
+                       
+                       thumb_area.X = thumb_pos.X;
+                       thumb_area.Y = channel_startpoint.Y;
+                       thumb_area.Width = thumb_pos.Height;
                        
                        /* Draw ticks*/
-                       if (pixels_betweenticks > 0 && ((tb.TickStyle & TickStyle.BottomRight) == TickStyle.BottomRight ||
-                               ((tb.TickStyle & TickStyle.Both) == TickStyle.Both))) { 
-                               
-                               for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks)  {                                       
-                                       if (inc == 0 || (inc +  pixels_betweenticks) >= pixel_len +1)
-                                               dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + bottomtick_startpoint.X , area.Y + bottomtick_startpoint.Y  + inc, 
-                                                       area.X + bottomtick_startpoint.X  + 3, area.Y + bottomtick_startpoint.Y + inc);
-                                       else
-                                               dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + bottomtick_startpoint.X, area.Y + bottomtick_startpoint.Y  + inc, 
-                                                       area.X + bottomtick_startpoint.X  + 2, area.Y + bottomtick_startpoint.Y + inc);
+                       Region outside = new Region (area);
+                       outside.Exclude (thumb_area);                   
+                       
+                       if (outside.IsVisible (clip_rectangle)) {                               
+                               if (pixels_betweenticks > 0 && ((tb.TickStyle & TickStyle.BottomRight) == TickStyle.BottomRight ||
+                                       ((tb.TickStyle & TickStyle.Both) == TickStyle.Both))) { 
+                                       
+                                       for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks)  {                                       
+                                               if (inc == 0 || (inc +  pixels_betweenticks) >= pixel_len +1)
+                                                       dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + bottomtick_startpoint.X , area.Y + bottomtick_startpoint.Y  + inc, 
+                                                               area.X + bottomtick_startpoint.X  + 3, area.Y + bottomtick_startpoint.Y + inc);
+                                               else
+                                                       dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + bottomtick_startpoint.X, area.Y + bottomtick_startpoint.Y  + inc, 
+                                                               area.X + bottomtick_startpoint.X  + 2, area.Y + bottomtick_startpoint.Y + inc);
+                                       }
+                               }
+       
+                               if (pixels_betweenticks > 0 &&  ((tb.TickStyle & TickStyle.TopLeft) == TickStyle.TopLeft ||
+                                       ((tb.TickStyle & TickStyle.Both) == TickStyle.Both))) {
+       
+                                       pixel_len = thumb_area.Height - 11;
+                                       pixels_betweenticks = pixel_len / ticks;
+                                       
+                                       for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) {                                        
+                                               if (inc == 0 || (inc +  pixels_betweenticks) >= pixel_len +1)
+                                                       dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + toptick_startpoint.X  - 3 , area.Y + toptick_startpoint.Y + inc, 
+                                                               area.X + toptick_startpoint.X, area.Y + toptick_startpoint.Y + inc);
+                                               else
+                                                       dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + toptick_startpoint.X  - 2, area.Y + toptick_startpoint.Y + inc, 
+                                                               area.X + toptick_startpoint.X, area.Y + toptick_startpoint.Y  + inc);
+                                       }                       
                                }
                        }
-
-                       if (pixels_betweenticks > 0 &&  ((tb.TickStyle & TickStyle.TopLeft) == TickStyle.TopLeft ||
-                               ((tb.TickStyle & TickStyle.Both) == TickStyle.Both))) {
-
-                               pixel_len = thumb_area.Height - 11;
-                               pixels_betweenticks = pixel_len / ticks;
-                               
-                               for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) {                                        
-                                       if (inc == 0 || (inc +  pixels_betweenticks) >= pixel_len +1)
-                                               dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + toptick_startpoint.X  - 3 , area.Y + toptick_startpoint.Y + inc, 
-                                                       area.X + toptick_startpoint.X, area.Y + toptick_startpoint.Y + inc);
-                                       else
-                                               dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + toptick_startpoint.X  - 2, area.Y + toptick_startpoint.Y + inc, 
-                                                       area.X + toptick_startpoint.X, area.Y + toptick_startpoint.Y  + inc);
-                               }                       
-                       }
+                       
                }
 
                /* 
@@ -3575,7 +3586,7 @@ namespace System.Windows.Forms
                                - Ticks are draw at (channel.Witdh - 10) / (Maximum - Minimum)
                                
                */
-               private void DrawTrackBar_Horizontal (Graphics dc, Rectangle area, TrackBar tb,
+               private void DrawTrackBar_Horizontal (Graphics dc, Rectangle clip_rectangle, TrackBar tb,
                        ref Rectangle thumb_pos, ref Rectangle thumb_area, Brush br_thumb,
                        float ticks, int value_pos, bool mouse_value) {                 
                        Point toptick_startpoint = new Point ();
@@ -3584,7 +3595,8 @@ namespace System.Windows.Forms
                        float pixel_len;
                        float pixels_betweenticks;
                        const int space_from_right = 8;
-                       const int space_from_left = 8;          
+                       const int space_from_left = 8;
+                       Rectangle area = tb.ClientRectangle;
                                                
                        switch (tb.TickStyle) {
                        case TickStyle.BottomRight:
@@ -3715,31 +3727,39 @@ namespace System.Windows.Forms
                        pixels_betweenticks = pixel_len / ticks;
 
                        /* Draw ticks*/
-                       if (pixels_betweenticks > 0 && ((tb.TickStyle & TickStyle.BottomRight) == TickStyle.BottomRight ||
-                               ((tb.TickStyle & TickStyle.Both) == TickStyle.Both))) {                         
-                               
-                               for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) {                                        
-                                       if (inc == 0 || (inc +  pixels_betweenticks) >= pixel_len +1)
-                                               dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + bottomtick_startpoint.X + inc , area.Y + bottomtick_startpoint.Y, 
-                                                       area.X + bottomtick_startpoint.X + inc , area.Y + bottomtick_startpoint.Y + 3);
-                                       else
-                                               dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + bottomtick_startpoint.X + inc, area.Y + bottomtick_startpoint.Y, 
-                                                       area.X + bottomtick_startpoint.X + inc, area.Y + bottomtick_startpoint.Y + 2);
+                       thumb_area.Y = thumb_pos.Y;
+                       thumb_area.X = channel_startpoint.X;
+                       thumb_area.Height = thumb_pos.Height;
+                       Region outside = new Region (area);
+                       outside.Exclude (thumb_area);                   
+                       
+                       if (outside.IsVisible (clip_rectangle)) {                               
+                               if (pixels_betweenticks > 0 && ((tb.TickStyle & TickStyle.BottomRight) == TickStyle.BottomRight ||
+                                       ((tb.TickStyle & TickStyle.Both) == TickStyle.Both))) {                         
+                                       
+                                       for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) {                                        
+                                               if (inc == 0 || (inc +  pixels_betweenticks) >= pixel_len +1)
+                                                       dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + bottomtick_startpoint.X + inc , area.Y + bottomtick_startpoint.Y, 
+                                                               area.X + bottomtick_startpoint.X + inc , area.Y + bottomtick_startpoint.Y + 3);
+                                               else
+                                                       dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + bottomtick_startpoint.X + inc, area.Y + bottomtick_startpoint.Y, 
+                                                               area.X + bottomtick_startpoint.X + inc, area.Y + bottomtick_startpoint.Y + 2);
+                                       }
                                }
-                       }
-
-                       if (pixels_betweenticks > 0 && ((tb.TickStyle & TickStyle.TopLeft) == TickStyle.TopLeft ||
-                               ((tb.TickStyle & TickStyle.Both) == TickStyle.Both))) {
-                               
-                               for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) {                                        
-                                       if (inc == 0 || (inc +  pixels_betweenticks) >= pixel_len +1)
-                                               dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + toptick_startpoint.X + inc , area.Y + toptick_startpoint.Y - 3, 
-                                                       area.X + toptick_startpoint.X + inc , area.Y + toptick_startpoint.Y);
-                                       else
-                                               dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + toptick_startpoint.X + inc, area.Y + toptick_startpoint.Y - 2, 
-                                                       area.X + toptick_startpoint.X + inc, area.Y + toptick_startpoint.Y );
-                               }                       
-                       }
+       
+                               if (pixels_betweenticks > 0 && ((tb.TickStyle & TickStyle.TopLeft) == TickStyle.TopLeft ||
+                                       ((tb.TickStyle & TickStyle.Both) == TickStyle.Both))) {
+                                       
+                                       for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) {                                        
+                                               if (inc == 0 || (inc +  pixels_betweenticks) >= pixel_len +1)
+                                                       dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + toptick_startpoint.X + inc , area.Y + toptick_startpoint.Y - 3, 
+                                                               area.X + toptick_startpoint.X + inc , area.Y + toptick_startpoint.Y);
+                                               else
+                                                       dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + toptick_startpoint.X + inc, area.Y + toptick_startpoint.Y - 2, 
+                                                               area.X + toptick_startpoint.X + inc, area.Y + toptick_startpoint.Y );
+                                       }                       
+                               }
+                       }                       
                }
 
                public override void DrawTrackBar (Graphics dc, Rectangle clip_rectangle, TrackBar tb) 
@@ -3751,7 +3771,7 @@ namespace System.Windows.Forms
                        Rectangle       area;
                        Rectangle       thumb_pos = tb.ThumbPos;
                        Rectangle       thumb_area = tb.ThumbArea;
-
+                       
                        if (tb.thumb_pressed) {
                                value_pos = tb.thumb_mouseclick;
                                mouse_value = true;
@@ -3760,7 +3780,7 @@ namespace System.Windows.Forms
                                mouse_value = false;
                        }
 
-                       area = tb.paint_area;
+                       area = tb.ClientRectangle;
 
                        if (tb.thumb_pressed == true) {
                                br_thumb = (Brush) ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace);
@@ -3771,9 +3791,9 @@ namespace System.Windows.Forms
                        
                        /* Control Background */
                        if (tb.BackColor == DefaultControlBackColor) {
-                               dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonFace), area);
+                               dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonFace), clip_rectangle);
                        } else {
-                               dc.FillRectangle (ResPool.GetSolidBrush (tb.BackColor), area);
+                               dc.FillRectangle (ResPool.GetSolidBrush (tb.BackColor), clip_rectangle);
                        }
                        
 
@@ -3785,11 +3805,11 @@ namespace System.Windows.Forms
                        }
 
                        if (tb.Orientation == Orientation.Vertical) {
-                               DrawTrackBar_Vertical (dc, area, tb, ref thumb_pos, ref thumb_area,
+                               DrawTrackBar_Vertical (dc, clip_rectangle, tb, ref thumb_pos, ref thumb_area,
                                        br_thumb, ticks, value_pos, mouse_value);
                        
                        } else {
-                               DrawTrackBar_Horizontal (dc, area, tb, ref thumb_pos, ref thumb_area,
+                               DrawTrackBar_Horizontal (dc, clip_rectangle, tb, ref thumb_pos, ref thumb_area,
                                        br_thumb, ticks, value_pos, mouse_value);
                        }
 
index 33370d96888d1a5b93766ceb452fe2138bee0929..eff461858ff551b7fd9edb6fcd5405213bd7fd28 100644 (file)
@@ -56,8 +56,7 @@ namespace System.Windows.Forms
                private int smallChange;
                private int largeChange;
                private Orientation orientation;
-               private TickStyle tickStyle;
-               internal Rectangle paint_area = new Rectangle ();
+               private TickStyle tickStyle;            
                private Rectangle thumb_pos = new Rectangle ();  /* Current position and size of the thumb */
                private Rectangle thumb_area = new Rectangle (); /* Area where the thumb can scroll */
                internal bool thumb_pressed = false;             
@@ -114,8 +113,7 @@ namespace System.Windows.Forms
                        tickStyle = TickStyle.BottomRight;
                        smallChange = 1;
                        largeChange = 5;                        
-                       mouse_clickmove = false;
-                       SizeChanged += new System.EventHandler (OnResizeTB);
+                       mouse_clickmove = false;                        
                        MouseDown += new MouseEventHandler (OnMouseDownTB); 
                        MouseUp += new MouseEventHandler (OnMouseUpTB); 
                        MouseMove += new MouseEventHandler (OnMouseMoveTB);
@@ -235,8 +233,7 @@ namespace System.Windows.Forms
                                if (value < 0)
                                        throw new Exception( string.Format("Value '{0}' must be greater than or equal to 0.", value));
 
-                               largeChange = value;
-                               Refresh ();
+                               largeChange = value;                            
                        }
                }
 
@@ -301,8 +298,7 @@ namespace System.Windows.Forms
                                        throw new Exception( string.Format("Value '{0}' must be greater than or equal to 0.", value));
 
                                if (smallChange != value) {
-                                       smallChange = value;
-                                       Refresh ();
+                                       smallChange = value;                                    
                                }
                        }
                }
@@ -363,7 +359,7 @@ namespace System.Windows.Forms
                                        if (ValueChanged != null)                               
                                                ValueChanged (this, new EventArgs ());
                                                
-                                       Refresh ();
+                                       Invalidate (thumb_area);
                                }                               
                        }
                }
@@ -390,23 +386,24 @@ namespace System.Windows.Forms
 
                protected override bool IsInputKey (Keys keyData)
                {
-                       return false;
+                       return base.IsInputKey (keyData);
                }
 
                protected override void OnBackColorChanged (EventArgs e)
                {
-
+                       base.OnBackColorChanged (e);
                }
 
                protected override void OnHandleCreated (EventArgs e)
-               {                       
+               {       
+                       base.OnHandleCreated (e);
+                                       
                        if (AutoSize)
                                if (Orientation == Orientation.Horizontal)
                                        Size = new Size (Width, 40);
                                else
                                        Size = new Size (50, Height);
-
-                       UpdateArea ();
+                       
                        UpdatePos (Value, true);                        
                }
        
@@ -439,9 +436,7 @@ namespace System.Windows.Forms
                public void SetRange (int minValue, int maxValue)
                {
                        Minimum = minValue;
-                       Maximum = maxValue;
-
-                       Refresh ();
+                       Maximum = maxValue;                     
                }
 
                public override string ToString()
@@ -482,14 +477,7 @@ namespace System.Windows.Forms
                #endregion Public Methods
 
                #region Private Methods
-
-               private void UpdateArea ()
-               {
-                       paint_area.X = paint_area.Y = 0;
-                       paint_area.Width = Width;
-                       paint_area.Height = Height;                     
-               }
-
+               
                private void UpdatePos (int newPos, bool update_trumbpos)
                {
                        if (newPos < minimum){
@@ -508,34 +496,34 @@ namespace System.Windows.Forms
                private void LargeIncrement ()
                {                       
                        UpdatePos (position + LargeChange, true);
-                       Refresh ();
+                       Invalidate (thumb_area);
                        OnScroll (new EventArgs ());
                }
 
                private void LargeDecrement ()
                {
                        UpdatePos (position - LargeChange, true);
-                       Refresh ();
+                       Invalidate (thumb_area);
                        OnScroll (new EventArgs ());
                }
 
                private void SmallIncrement ()
                {                       
                        UpdatePos (position + SmallChange, true);
-                       Refresh ();
+                       Invalidate (thumb_area);
                        OnScroll (new EventArgs ());
                }
 
                private void SmallDecrement ()
                {
                        UpdatePos (position - SmallChange, true);
-                       Refresh ();
+                       Invalidate (thumb_area);
                        OnScroll (new EventArgs ());    
                }
                
-               private void Draw ()
+               private void Draw (Rectangle clip)
                {                                       
-                       ThemeEngine.Current.DrawTrackBar(DeviceContext, this.ClientRectangle, this);
+                       ThemeEngine.Current.DrawTrackBar (DeviceContext, clip, this);                   
                }               
 
                private void OnMouseUpTB (object sender, MouseEventArgs e)
@@ -546,7 +534,7 @@ namespace System.Windows.Forms
                                thumb_pressed = false;
                                holdclick_timer.Enabled = false;
                                this.Capture = false;
-                               Refresh ();
+                               Invalidate (thumb_area);
                        }
                }
 
@@ -564,16 +552,16 @@ namespace System.Windows.Forms
                                        this.Capture = true;
                                        thumb_pressed = true;
                                        thumb_mouseclick = e.X;
-                                       Refresh ();                                     
+                                       Invalidate (thumb_area);
                                }
                                else {
-                                       if (paint_area.Contains (point)) {
+                                       if (ClientRectangle.Contains (point)) {
                                                if (e.X > thumb_pos.X + thumb_pos.Width)
                                                        LargeIncrement ();
                                                else
                                                        LargeDecrement ();
 
-                                               Refresh ();
+                                               Invalidate (thumb_area);
                                                fire_timer = true;
                                                mouse_clickmove = true;
                                        }
@@ -584,17 +572,17 @@ namespace System.Windows.Forms
                                        this.Capture = true;
                                        thumb_pressed = true;
                                        thumb_mouseclick = e.Y;
-                                       Refresh ();
+                                       Invalidate (thumb_area);
                                        
                                }
                                else {
-                                       if (paint_area.Contains (point)) {
+                                       if (ClientRectangle.Contains (point)) {
                                                if (e.Y > thumb_pos.Y + thumb_pos.Height)
                                                        LargeIncrement ();
                                                else
                                                        LargeDecrement ();
 
-                                               Refresh ();
+                                               Invalidate (thumb_area);
                                                fire_timer = true;
                                                mouse_clickmove = true;
                                        }
@@ -615,27 +603,20 @@ namespace System.Windows.Forms
                        if (thumb_pressed) {
                                                                                                
                                if (orientation == Orientation.Horizontal){
-                                       if (paint_area.Contains (e.X, thumb_pos.Y))
+                                       if (ClientRectangle.Contains (e.X, thumb_pos.Y))
                                                thumb_mouseclick = e.X; 
                                }
                                else {
-                                       if (paint_area.Contains (thumb_pos.X, e.Y))
+                                       if (ClientRectangle.Contains (thumb_pos.X, e.Y))
                                                thumb_mouseclick = e.Y;
                                }
 
-                               Refresh ();
+                               Invalidate (thumb_area);
                                OnScroll (new EventArgs ());
                        }
                }
 
-               private void OnResizeTB (object sender, System.EventArgs e)
-               {                       
-                       if (Width <= 0 || Height <= 0)
-                               return;
-
-                       UpdateArea ();
-               }               
-
+               
                private void OnPaintTB (PaintEventArgs pevent)
                {               
                        if (Paint != null) {
@@ -645,24 +626,40 @@ namespace System.Windows.Forms
                        if (Width <= 0 || Height <=  0 || Visible == false)
                                return;         
 
-                       /* Copies memory drawing buffer to screen*/
-                       UpdateArea ();
-                       Draw ();
-                       pevent.Graphics.DrawImage (ImageBuffer, 0, 0);                  
+                       /* Copies memory drawing buffer to screen */
+                       Draw (pevent.ClipRectangle);
+                       pevent.Graphics.DrawImage (ImageBuffer, pevent.ClipRectangle, pevent.ClipRectangle, GraphicsUnit.Pixel);
                }  
 
                private void OnKeyDownTB (KeyEventArgs e) \r
                {                       
                        switch (e.KeyCode) {                    \r
-                       case Keys.Up:
+                       
+                       case Keys.Down:
                        case Keys.Right:
                                SmallIncrement ();
                                break;
-
-                       case Keys.Down:
+                       
+                       case Keys.Up:
                        case Keys.Left:
                                SmallDecrement ();
                                break;
+                               
+                       case Keys.PageUp:
+                               LargeDecrement ();
+                               break;
+                               
+                       case Keys.PageDown:
+                               LargeIncrement ();
+                               break;
+                               
+                       case Keys.Home:
+                               Value = Minimum;
+                               break;
+                       
+                       case Keys.End:
+                               Value = Maximum;
+                               break;
                        
                        default:
                                break;
@@ -690,7 +687,7 @@ namespace System.Windows.Forms
                                                LargeDecrement ();
                                }
 
-                               Refresh ();
+                               Invalidate (thumb_area);
 \r
                        }                       \r
                }