Author: ivanz
Date: 2008-02-12 11:54:27 -0500 (Tue, 12 Feb 2008)
New Revision: 95527

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

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



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2008-02-12 16:54:18 UTC (rev 95526)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2008-02-12 16:54:27 UTC (rev 95527)
@@ -1,5 +1,11 @@
 2008-02-12  Ivan N. Zlatev  <[EMAIL PROTECTED]>
 
+       * 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]>
+
        * GridEntry.cs: Fail silently when UITypeEditor is missing.
        [Fixes bug #360666]
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs  
    2008-02-12 16:54:18 UTC (rev 95526)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs  
    2008-02-12 16:54:27 UTC (rev 95527)
@@ -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