[MWF] Fix ComboBox list to not display offscreen (#15462)
authorStephen McConnel <stephen_mcconnel@sil.org>
Thu, 17 Oct 2013 16:43:42 +0000 (11:43 -0500)
committerEberhard Beilharz <eb1@sil.org>
Fri, 16 May 2014 14:21:59 +0000 (16:21 +0200)
The fix mimics the behavior of Windows/.NET.

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs

index d58ad360c0b2f493ef6d83ddd05613269e015b3e..07bf3e56fb33e7343d9322d603f28da49c4dede5 100644 (file)
@@ -2757,6 +2757,10 @@ namespace System.Windows.Forms
                                HighlightedIndex = owner.SelectedIndex;
 
                                CalcListBoxArea ();
+                               // If the listbox would extend below the screen, move it above the textbox.
+                               Rectangle scrn_rect = Screen.FromControl (owner).Bounds;
+                               if (this.Location.Y + this.Height >= scrn_rect.Bottom)
+                                       this.Location = new Point (this.Location.X, this.Location.Y - (this.Height + owner.TextArea.Height));
                                Show ();
 
                                Refresh ();