* XplatUIX11.cs: Removed unused hwnd var in SetBorderStyle.
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / SizeGrip.cs
index 1bfb4298d1c1fb8af3eac716d042ca362dac1468..a8a2c51d7d44dda0b7c5dc357039c953430cdbeb 100644 (file)
@@ -22,8 +22,6 @@
 // Authors:
 //     Jackson Harper (jackson@ximian.com)
 
-// TODO: Eventually we need to handle the cursor and resizing the parent
-
 using System;
 using System.Drawing;
 
@@ -33,6 +31,7 @@ namespace System.Windows.Forms {
                #region Local Variables
                private bool    redraw;
                private Point   capture_point;
+               private Control captured_control;
                private int     window_w;
                private int     window_h;
                private bool    show_grip;
@@ -50,6 +49,19 @@ namespace System.Windows.Forms {
                #endregion      // Constructors
 
                #region Properties
+               
+               public Control CapturedControl {
+                       get {
+                               if (captured_control != null)
+                                       return captured_control;
+                               else
+                                       return Parent;
+                       }
+                       set {
+                               captured_control = value;
+                       }
+               }
+               
                public bool ShowGrip {
                        get {
                                return show_grip;
@@ -64,11 +76,11 @@ namespace System.Windows.Forms {
 
                #region Methods
                protected override void OnPaint (PaintEventArgs pe) {
-                       base.OnPaint (pe);
-
                        if (redraw && show_grip) {
+                               pe.Graphics.FillRectangle (new SolidBrush (ThemeEngine.Current.ColorControl), ClientRectangle);
                                 ControlPaint.DrawSizeGrip (pe.Graphics, BackColor, ClientRectangle);
                        }
+                       base.OnPaint (pe);
                }
 
                protected override void OnSizeChanged (EventArgs e) {
@@ -86,12 +98,12 @@ namespace System.Windows.Forms {
                        
                        capture_point = Control.MousePosition;
 
-                       window_w = parent.Width;
-                       window_h = parent.Height;
+                       window_w = CapturedControl.Width;
+                       window_h = CapturedControl.Height;
                }
 
                protected override void OnMouseMove(MouseEventArgs e) {
-                       if (this.is_captured) {
+                       if (Capture) {
                                int     delta_x;
                                int     delta_y;
                                Point   current_point;
@@ -101,7 +113,7 @@ namespace System.Windows.Forms {
                                delta_x = current_point.X - capture_point.X;
                                delta_y = current_point.Y - capture_point.Y;
 
-                               this.parent.Size = new Size(window_w + delta_x, window_h + delta_y);
+                               CapturedControl.Size = new Size(window_w + delta_x, window_h + delta_y);
                                XplatUI.DoEvents();
                        }
                }