Author: jackson
Date: 2006-01-16 18:20:29 -0500 (Mon, 16 Jan 2006)
New Revision: 55661
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
Log:
* ComboBox.cs: Set the initial value of the scrollbar to the
current index. Reduce the numbers of refreshs and IndexOfs
called.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-01-16 22:59:02 UTC (rev 55660)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-01-16 23:20:29 UTC (rev 55661)
@@ -1,3 +1,8 @@
+2006-01-16 Jackson Harper <[EMAIL PROTECTED]>
+
+ * ComboBox.cs: Set the initial value of the scrollbar to the
+ current index. Reduce the numbers of refreshs and IndexOfs called.
+
2006-01-14 Alexander Olk <[EMAIL PROTECTED]>
* FileDialog.cs: When the file listview is focused hitting the
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
2006-01-16 22:59:02 UTC (rev 55660)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
2006-01-16 23:20:29 UTC (rev 55661)
@@ -1211,12 +1211,11 @@
private void UpdatedItems ()
{
- if (dropdown_style != ComboBoxStyle.Simple)
- return;
-
- listbox_ctrl.UpdateLastVisibleItem ();
- listbox_ctrl.CalcListBoxArea ();
- listbox_ctrl.Refresh ();
+ if (listbox_ctrl != null) {
+ listbox_ctrl.UpdateLastVisibleItem ();
+ listbox_ctrl.CalcListBoxArea ();
+ listbox_ctrl.Refresh ();
+ }
}
#endregion Private Methods
@@ -1588,6 +1587,10 @@
vscrollbar_ctrl.Maximum =
owner.Items.Count - (owner.DropDownStyle == ComboBoxStyle.Simple ? page_size :
owner.maxdrop_items);
show_scrollbar =
vscrollbar_ctrl.Visible = true;
+
+ int hli = GetHighLightedIndex ();
+ if (hli > 0)
+ vscrollbar_ctrl.Value = hli;
}
Size = new Size (width, height);
@@ -1795,7 +1798,7 @@
}
}
}
-
+
private void OnKeyDownPUW (object sender, KeyEventArgs
e)
{
switch (e.KeyCode) {
@@ -1822,27 +1825,29 @@
public void SetHighLightedItem (object item)
{
- Rectangle invalidate;
+ Rectangle invalidate = Rectangle.Empty;
+ int hli;
if (GetHighLightedItem () == item)
return;
/* Previous item */
- if (GetHighLightedIndex () != -1) {
- invalidate = GetItemDisplayRectangle
(GetHighLightedIndex (), top_item);
- if (ClientRectangle.IntersectsWith
(invalidate))
- Invalidate (invalidate);
+ hli = GetHighLightedIndex ();
+ if (hli != -1) {
+ invalidate = GetItemDisplayRectangle
(hli, top_item);
}
highlighted_item = item;
if (highlighted_item != null) {
/* Current item */
- invalidate = GetItemDisplayRectangle
(GetHighLightedIndex (), top_item);
- if (ClientRectangle.IntersectsWith
(invalidate))
- Invalidate (invalidate);
+ invalidate = Rectangle.Union
(invalidate,
+ GetItemDisplayRectangle
(GetHighLightedIndex (), top_item));
+
}
-
+
+ if (ClientRectangle.IntersectsWith (invalidate))
+ Invalidate (invalidate);
}
public void SetTopItem (int item)
@@ -1962,7 +1967,7 @@
SetHighLightedItem (owner.SelectedItem);
int index = GetHighLightedIndex ();
- SetTopItem (index == -1 ? 0 : index );
+ top_item = (index == -1 ? 0 : index );
CalcListBoxArea ();
Show ();
@@ -1988,6 +1993,9 @@
// Value Changed
private void VerticalScrollEvent (object sender,
EventArgs e)
{
+ if (top_item == vscrollbar_ctrl.Value)
+ return;
+
top_item = vscrollbar_ctrl.Value;
UpdateLastVisibleItem ();
Refresh ();
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches