Author: ivanz
Date: 2008-02-12 11:56:20 -0500 (Tue, 12 Feb 2008)
New Revision: 95528

Modified:
   
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
Log:
2008-02-12  Ivan N. Zlatev  <[EMAIL PROTECTED]>

        [Backport to 1.9]
        * PropertyGridView.cs: Ensure that drop down editors are shown
        in the WorkingArea of the screen.
        [Fixes bug #359807]



Modified: 
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- 
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
    2008-02-12 16:54:27 UTC (rev 95527)
+++ 
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
    2008-02-12 16:56:20 UTC (rev 95528)
@@ -1,6 +1,13 @@
 2008-02-12  Ivan N. Zlatev  <[EMAIL PROTECTED]>
 
        [Backport to 1.9]
+       * PropertyGridView.cs: Ensure that drop down editors are shown
+       in the WorkingArea of the screen.
+       [Fixes bug #359807]
+
+2008-02-12  Ivan N. Zlatev  <[EMAIL PROTECTED]>
+
+       [Backport to 1.9]
        * GridEntry.cs: Fail silently when UITypeEditor is missing.
        [Fixes bug #360666]
 

Modified: 
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
===================================================================
--- 
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
  2008-02-12 16:54:27 UTC (rev 95527)
+++ 
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
  2008-02-12 16:56:20 UTC (rev 95528)
@@ -897,6 +897,7 @@
                        dropdown_form.Width = Math.Max (ClientRectangle.Width - 
SplitterLocation - (vbar.Visible ? vbar.Width : 0), 
                                                        control.Width);
                        dropdown_form.Location = PointToScreen (new Point 
(grid_textbox.Right - control.Width, grid_textbox.Location.Y + row_height));
+                       RepositionInScreenWorkingArea (dropdown_form);
                        location = dropdown_form.Location;
 
                        owner.AddOwnedForm (dropdown_form);
@@ -933,6 +934,26 @@
                        }
                }
 
+               private void RepositionInScreenWorkingArea (Form form)
+               {
+                       Rectangle workingArea = Screen.FromControl 
(form).WorkingArea;
+                       if (!workingArea.Contains (form.Bounds)) {
+                               int x, y;
+                               x = form.Location.X;
+                               y = form.Location.Y;
+
+                               if (form.Location.X < workingArea.X)
+                                       x = workingArea.X;
+
+                               if (form.Location.Y + form.Size.Height > 
workingArea.Height) {
+                                       Point aboveTextBox = PointToScreen (new 
Point (grid_textbox.Right - form.Width, grid_textbox.Location.Y));
+                                       y = aboveTextBox.Y - form.Size.Height;
+                               }
+
+                               form.Location = new Point (x, y);
+                       }
+               }
+
                private bool HwndInControl (Control c, IntPtr hwnd)
                {
                        if (hwnd == c.window.Handle)

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

Reply via email to