[Mono-bugs] [Bug 80597][Min] New - Form size grip does not match Microsoft behavior

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jan 24 08:44:00 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by georgegiolfan at yahoo.com.

http://bugzilla.ximian.com/show_bug.cgi?id=80597

--- shadow/80597	2007-01-24 08:44:00.000000000 -0500
+++ shadow/80597.tmp.17048	2007-01-24 08:44:00.000000000 -0500
@@ -0,0 +1,91 @@
+Bug#: 80597
+Product: Mono: Class Libraries
+Version: 1.2
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: georgegiolfan at yahoo.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Form size grip does not match Microsoft behavior
+
+Description of Problem:
+The size grip works fine until another window shows up.
+
+Steps to reproduce the problem:
+Resize a window using the grip and while you do that have another window 
+become active.
+
+Actual Results:
+If you release the mouse button while another window is active and then 
+move the mouse over the grip it resizes the window.
+
+Expected Results:
+The size grip behaves like the Microsoft implementation.
+
+How often does this happen? 
+Always (on the SVN version).
+
+Additional Information:
+My idea is to stop resizing once mouse capture is lost. Here is an 
+example. It does not currently work on MWF.
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+class TestForm : Form {
+    static void Main() {
+        Application.Run(new TestForm());
+    }
+    public TestForm() {
+        MySizeGrip s = new MySizeGrip(this);
+        s.Location = new Point(ClientSize.Width - s.Width, 
+ClientSize.Height - s.Height);
+        s.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
+        Controls.Add(s);
+    }
+}
+class MySizeGrip : Control {
+    Form Form;
+    public MySizeGrip(Form form) {
+        Form = form;
+        // Just so that it can be used.
+        BackColor = Color.Red;
+        Size = new Size(10, 10);
+    }
+    bool Resizing;
+    int InitialX, InitialY;
+    Size InitialSize;
+    protected override void OnMouseDown(MouseEventArgs e) {
+        base.OnMouseDown(e);
+        Resizing = true;
+        InitialX = e.X;
+        InitialY = e.Y;
+        InitialSize = Form.Size;
+    }
+    protected override void OnMouseMove(MouseEventArgs e) {
+        base.OnMouseMove(e);
+        if (Resizing) {
+            Form.Size = new Size(Form.Width + e.X - InitialX, Form.Height 
++ e.Y - InitialY);
+            Application.DoEvents();
+        }
+    }
+    protected override void OnMouseUp(MouseEventArgs e) {
+        base.OnMouseUp(e);
+        Resizing = false;
+    }
+    // This is what I mean.
+    // Seems close to Microsoft behavior.
+    protected override void OnMouseCaptureChanged(EventArgs e) {
+        base.OnMouseCaptureChanged(e);
+        Resizing = false;
+        Form.Size = InitialSize;
+    }
+}


More information about the mono-bugs mailing list