Kaynağa Gözat

- Reenable SetBottom now that visible orders are set correctly,
added some debug code incase we ever get bad values there again.
- Set the scrollbar max to 2 less then the max value, this
compensates for the max value being one above the node count,
and
for scrollbars adding one extra "notch".


svn path=/trunk/mcs/; revision=61090

Jackson Harper 19 yıl önce
ebeveyn
işleme
42e454fc0b

+ 5 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -10,6 +10,11 @@
 	- When updating below the root node use an invalidate instead of a
 	refresh to prevent the child controls (scrollbars) from being
 	refreshed. (UpdateBelow still needs to be reworked anyways).
+	- Reenable SetBottom now that visible orders are set correctly,
+	added some debug code incase we ever get bad values there again.
+	- Set the scrollbar max to 2 less then the max value, this
+	compensates for the max value being one above the node count, and
+	for scrollbars adding one extra "notch".
 	
 2006-05-24  Peter Dennis Bartok  <[email protected]> 
 

+ 10 - 6
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs

@@ -903,7 +903,6 @@ namespace System.Windows.Forms {
 
 		internal void SetBottom (TreeNode node)
 		{
-/*
 			if (!vbar.Visible)
 				return;
 
@@ -918,10 +917,15 @@ namespace System.Windows.Forms {
 			}
 
 			int nv = vbar.Value + offset;
-//			Console.WriteLine ("NEW VALUE:   {0}    OFFSET:   {1}     MAXIMUM:   {2}", nv, offset, vbar.Maximum);
-			if (vbar.Value + offset < vbar.Maximum)
-				vbar.Value += offset;
-*/
+			if (vbar.Value + offset < vbar.Maximum) {
+				vbar.Value = nv;
+			} else {
+#if DEBUG
+				Console.Error.WriteLine ("setting bottom to value greater then maximum ({0}, {1})",
+						nv, vbar.Maximum);
+#endif
+			}
+				
 		}
 
 		internal void UpdateBelow (TreeNode node)
@@ -1270,7 +1274,7 @@ namespace System.Windows.Forms {
 				vert = true;
 
 			if (vert) {
-				vbar.SetValues (max_visible_order, ClientRectangle.Height / ItemHeight);
+				vbar.SetValues (max_visible_order - 2, ViewportRectangle.Height / ItemHeight);
 				/*
 				vbar.Maximum = max_visible_order;
 				vbar.LargeChange = ClientRectangle.Height / ItemHeight;