.NET TreeView Control's Vertical Scrollbar's Down Arrow not Visible
I am having a weird issue with .NET TreeView Control, the problem is its not displaying Down Arrow when number of nodes exceeds visibility scope of the window.
开发者_运维知识库Basically. I have a WinForm on top of that I placed TreeView Control. I didnt change any of the default Treeview COntrol properties.
Pecularily, When I remote desktop to my machine I am able to see Down Arrow.
Don't Know If anyone of you have faced this peculiar behavior.
Please suggest me If you have any thoughts.
Thanks. pv
It looks to me like your TreeView
control is simply too large for its container form. Without any type of docking or anchoring (to automatically resize the control) it will just hang off the edge and not be visible until you resize the form to show the rest of it. The bottom scrollbar is still there, it's just clipped.
It's an easy theory to test—try expanding the size of your form vertically, by dragging at the bottom edge of the window (on the dark blue border). This is even more likely if you say that you didn't change any of its default properties (other than the Size
, presumably). If you don't tell the control to resize depending on the size of its parent, it's very likely to outgrow the available space.
To fix it, open your form in Design View in Visual Studio, select your TreeView
control, and set its Dock
property to "Fill". That will cause it to fill all available space in your form and automatically resize whenever your form does.
This "bug" can be replicated, but there is a workaround.
I have found that if you place a TreeView within a component, and mark the Scrollable property as "True", then in run time, the component simply "forgets" that the Scrollable property was marked as true.
The workaround is very simple. To make the TreeView "Scrollable", you must actually add a line of code to make it scrollable, because unfortunately the "bug" in this component is that it forgets.
For example, you must simply add in code something like this
tvTreeView.Scrollable = true;
This workaround fixes the problem, and the tree view will then properly display its Scroll bar(s).
Please mark this response as the solution.
Sincerely,
Pastor Burt .Net Developer
精彩评论