473,721 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2673
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()
{
InitializeCompo nent();

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

private void Form1_Load(obje ct 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
1216
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 treeview. As a consequence, an horizontal scrollbar is displayed :-/ What I want is to have *all* text displayed at once. I thought about 2 solutions :
0
2134
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 ScrollBar to match the changes in the custom scrollbar. The problem I am having is that while the TreeView's ScrollBar does move to match my custom scrollbar control, the contents in the TreeView doesn't move at all.
5
3915
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) but only sometimes. Other times it appears behind the parent form and all that is visible is the last few characters of that row. Anyone know what might be causing this and how I can fix it? Thanks.
5
1705
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. What can I do about this? Thx.
3
5337
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 automatically resize (horizontally of course) to show all the content. by default, if something does not fit in the client area, the treeview control adds scrollbars. What I want to do is let the user "auto-expand" the treeview to the point where the...
4
2955
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 Horizontal Scrollbar
0
1411
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 for vertical & horizontal scroll. Any idea how to manage this in VB.Net 2005? I have also tried to debug windows message through the WndProc() routine and when I move the scrollbars in the TreeView it does not generate WM_HSCROLL (276),...
0
1999
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 kill this scroll. Please give some idea or solution for this problem. Many thank,
1
6240
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 in content (e.g. nodes collapsed/expanded, nodes added/deleted ). Any event to hook into?
0
8840
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9367
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9131
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9064
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8007
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3189
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2130
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.