Author: mkestner
Date: 2006-11-30 10:16:06 -0500 (Thu, 30 Nov 2006)
New Revision: 68747

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
Log:

2006-11-30  Mike Kestner  <[EMAIL PROTECTED]>

        * ComboBox.cs: fixes for LargeChange and Maximum to get the 
        scroll range correct.  Fixes #79994.


Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-11-30 15:07:43 UTC (rev 68746)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-11-30 15:16:06 UTC (rev 68747)
@@ -1,3 +1,8 @@
+2006-11-30  Mike Kestner  <[EMAIL PROTECTED]>
+
+       * ComboBox.cs: fixes for LargeChange and Maximum to get the 
+       scroll range correct.  Fixes #79994.
+
 2006-11-30  Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
 
        * MdiWindowManager.cs: Update main form's text when

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs      
2006-11-30 15:07:43 UTC (rev 68746)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs      
2006-11-30 15:16:06 UTC (rev 68747)
@@ -1639,6 +1639,8 @@
                                        }
                                }
                                
+                               page_size = height / owner.ItemHeight;
+
                                if (owner.Items.Count <= 
owner.MaxDropDownItems) {                                      
                                        if (vscrollbar_ctrl != null)
                                                vscrollbar_ctrl.Visible = false;
@@ -1658,8 +1660,11 @@
                                                        
                                        vscrollbar_ctrl.Location = new Point 
(width - vscrollbar_ctrl.Width - BorderWidth - 1, 0);
 
-                                       vscrollbar_ctrl.Maximum = 
owner.Items.Count - (owner.DropDownStyle == ComboBoxStyle.Simple ? page_size : 
owner.maxdrop_items);
-                                       vscrollbar_ctrl.LargeChange = 
owner.MaxDropDownItems - 1;
+                                       vscrollbar_ctrl.Maximum = 
owner.Items.Count - 2;
+                                       int large = (owner.DropDownStyle == 
ComboBoxStyle.Simple ? page_size : owner.maxdrop_items) - 1;
+                                       if (large < 0)
+                                               large = 0;
+                                       vscrollbar_ctrl.LargeChange = large;
                                        show_scrollbar = 
vscrollbar_ctrl.Visible = true;
 
                                        int hli = HighlightedIndex;
@@ -1678,7 +1683,6 @@
                                        textarea_drawable.Width -= 
vscrollbar_ctrl.Width;
 
                                last_item = LastVisibleItem ();
-                               page_size = textarea_drawable.Height / 
owner.ItemHeight;
                        }                       
 
                        private void Draw (Rectangle clip, Graphics dc)
@@ -1866,7 +1870,7 @@
                                if (delta == 0 || vscrollbar_ctrl == null || 
!vscrollbar_ctrl.Visible)
                                        return;
 
-                               int max = vscrollbar_ctrl.Maximum;//- 
(page_size) + 1;
+                               int max = owner.Items.Count - page_size;
 
                                int val = vscrollbar_ctrl.Value + delta;
                                if (val > max)

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

Reply via email to