473,394 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

TreeView starts with useless Horizontal Scrollbar

Does anyone know what causes a treeview to sometimes start with a
horizontal scrollbar that has no reason to be there, and will not go
away until you size into the nodes and then back out?

Anyone know how to correct this bug?

My treeview was working fine until I added it to a tab page :(

Thanks,
Benny
Nov 23 '05 #1
2 2653
Did a lot of research and discovered that this is a known issue in .net
- it's supposedly fixed in 2005 but in earlier versions you cannot put
nodes in a tree view until after it has been created... Since I put the
treeview into a tabpage the same thing occured because i was loading
nodes since I didn't show the page until after I loaded the nodes in.

So I guess i'm going to move my tree view into it's own form and make an
MDI with custom tabs ... unless anyone else has a good idea?

Benny Raymond wrote:
Does anyone know what causes a treeview to sometimes start with a
horizontal scrollbar that has no reason to be there, and will not go
away until you size into the nodes and then back out?

Anyone know how to correct this bug?

My treeview was working fine until I added it to a tab page :(

Thanks,
Benny

Nov 23 '05 #2
Hi Benny,
I was having the same problem recently even using VS 2005. I found a work
around it is a little bit of a hack but it works perfectly. Basically what
you have to do is make the width of your control small such that the scroll
bar is really needed i.e. set the width to 20, then load your nodes. Do the
first two things then after you have done that programatically set the width
back to the normal width you originally wanted and the scrollbar will not
apppear.

The real trick though is you cannot set the width twice in the same meothd,
you have to set it to a larger width in the load method of the control i.e.

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

this.treeView1.Width = 20;
this.treeView1.Nodes.Add("bob");
}

private void Form1_Load(object sender, EventArgs e)
{
this.treeView1.Nodes.Add("bob2");

this.treeView1.Width = 200;
}
}

Hope that helps
Mark R Dawson
http://www.markdawson.org

"Benny Raymond" wrote:
Did a lot of research and discovered that this is a known issue in .net
- it's supposedly fixed in 2005 but in earlier versions you cannot put
nodes in a tree view until after it has been created... Since I put the
treeview into a tabpage the same thing occured because i was loading
nodes since I didn't show the page until after I loaded the nodes in.

So I guess i'm going to move my tree view into it's own form and make an
MDI with custom tabs ... unless anyone else has a good idea?

Benny Raymond wrote:
Does anyone know what causes a treeview to sometimes start with a
horizontal scrollbar that has no reason to be there, and will not go
away until you size into the nodes and then back out?

Anyone know how to correct this bug?

My treeview was working fine until I added it to a tab page :(

Thanks,
Benny

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Frederic L. | last post by:
Hi, I have a treeview on a form, with several nodes, on several level. Every node has a text associated to it. That text can be quite long,and sometimes, is longer than the width of the...
0
by: rh | last post by:
Hi, I have a WinForm with a TreeView and a custom scrollbar control that is positioned over (hides) the TreeView's own default ScrollBar. I use SetScrollInfo to update the TreeView's default...
5
by: rh | last post by:
I created a user control that is made up of a TreeView and a VScrollBar. I set the TreeView.FullRowSelect = True and it works as expected (full row is visible, appears on top of everything else)...
5
by: Bart Schelkens | last post by:
Hi, i'm using the treeview from the Microsoft.Web.UI.Webcontrols.Treeview. It works fine. But my problem is that I don't get scrollbars if my treeview is too long or too wide for my frame....
3
by: Juan Romero | last post by:
Hey guys, Does anyone know how to get the width of of the client area of the treeview control? What I am trying to do is let the users double click on a split control and have the treeview...
4
by: Sakharam Phapale | last post by:
Hi All, I have installed VS .NET 2002 on my machine. I have checked both Vertical scrollbar and Horizontal Scrollbar options, in Tools -> Options-> Text Editor-> General-> Vertical Scrollbar...
0
by: Sanjib Biswas | last post by:
Hi, I would like to know how to synchronize the vertical & horizontal scrollbars in 2 TreeView to move up & down, left & right synchronously. Noticed that TreeView does not have any scroll event...
0
by: bipi | last post by:
Now, I have treeview with Scrollbar properties is true, it mean that I will have two scroll (vertical scrollbar and horizontal scrollbar) . So, I don't want to use horizontal scrollbar, I want to...
1
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, Is there a way to detect whenever scrollbars (the vertical) are shown on a treeview I need to know. 1) If scrollbars are visible after a rezise 2) If scrollbars are visible after change...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.