472,328 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 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 2603
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...
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...
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...
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...
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...
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 ->...
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....
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...
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...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...

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.