Просмотр исходного кода

- Use the client rectangle when setting the trees scrollbars, so
border style is taken into account.


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

Jackson Harper 19 лет назад
Родитель
Сommit
db203345fe

+ 3 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -3,7 +3,9 @@
 	* LabelEditTextBox.cs:
 	* TreeView.cs: Use a new LabelEdit class for node editing, this
 	class automatically 'closes' itself when it gets the enter key or
-	loses focus.	
+	loses focus.
+	- Use the client rectangle when setting the trees scrollbars, so
+	border style is taken into account.
 	
 2006-07-14  Jackson Harper  <[email protected]>
 

+ 12 - 9
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs

@@ -127,7 +127,6 @@ namespace System.Windows.Forms {
 			string_format.LineAlignment = StringAlignment.Center;
 			string_format.Alignment = StringAlignment.Center;
 
-			
 			vbar = new ImplicitVScrollBar ();
 			hbar = new ImplicitHScrollBar ();
 
@@ -135,6 +134,7 @@ namespace System.Windows.Forms {
 			hbar.Visible = false;
 			vbar.ValueChanged += new EventHandler (VScrollBarValueChanged);
 			hbar.ValueChanged += new EventHandler (HScrollBarValueChanged);
+
 			SuspendLayout ();
 			Controls.AddImplicit (vbar);
 			Controls.AddImplicit (hbar);
@@ -532,6 +532,8 @@ namespace System.Windows.Forms {
 		#region Protected Instance Methods
 		protected override void CreateHandle () {
 			base.CreateHandle ();
+
+			UpdateScrollBars ();
 		}
 
 		protected override void Dispose (bool disposing) {
@@ -783,7 +785,6 @@ namespace System.Windows.Forms {
 			return null;
 		}
 
-		// TODO: we shouldn't have to compute this on the fly
 	        internal Rectangle ViewportRectangle {
 			get {
 				Rectangle res = ClientRectangle;
@@ -1270,7 +1271,6 @@ namespace System.Windows.Forms {
 			if (scrollable) {
 				OpenTreeNodeEnumerator walk = new OpenTreeNodeEnumerator (root_node);
 				
-				
 				while (walk.MoveNext ()) {
 					int r = walk.CurrentNode.Bounds.Right;
 					int b = walk.CurrentNode.Bounds.Bottom;
@@ -1308,7 +1308,8 @@ namespace System.Windows.Forms {
 
 				if (!vbar_bounds_set) {
 					vbar.Bounds = new Rectangle (ClientRectangle.Width - vbar.Width, 0, vbar.Width,
-							Height - (hbar.Visible ? SystemInformation.VerticalScrollBarWidth : 0));
+							ClientRectangle.Height -
+							(hbar.Visible ? SystemInformation.VerticalScrollBarWidth : 0));
 					vbar_bounds_set = true;
 				}
 
@@ -1329,8 +1330,9 @@ namespace System.Windows.Forms {
 				*/
 
 				if (!hbar_bounds_set) {
-					hbar.Bounds = new Rectangle (0, Height - hbar.Height,
-							Width - (vbar.Visible ? SystemInformation.HorizontalScrollBarHeight : 0),
+					hbar.Bounds = new Rectangle (0, ClientRectangle.Height - hbar.Height,
+							ClientRectangle.Width - (vbar.Visible ?
+									SystemInformation.HorizontalScrollBarHeight : 0),
 							hbar.Height);
 					hbar_bounds_set = true;
 				}
@@ -1348,14 +1350,15 @@ namespace System.Windows.Forms {
 				UpdateScrollBars ();
 
 			}
+
 			if (vbar.Visible) {
 				vbar.Bounds = new Rectangle (ClientRectangle.Width - vbar.Width, 0, vbar.Width,
-						Height - (hbar.Visible ? SystemInformation.VerticalScrollBarWidth : 0));
+						ClientRectangle.Height - (hbar.Visible ? SystemInformation.VerticalScrollBarWidth : 0));
 			}
 
 			if (hbar.Visible) {
-				hbar.Bounds = new Rectangle (0, Height - hbar.Height,
-						Width - (vbar.Visible ? SystemInformation.HorizontalScrollBarHeight : 0), hbar.Height);
+				hbar.Bounds = new Rectangle (0, ClientRectangle.Height - hbar.Height,
+						ClientRectangle.Width - (vbar.Visible ? SystemInformation.HorizontalScrollBarHeight : 0), hbar.Height);
 			}
 		}