Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / September 2005

Tip: Looking for answers? Try searching our database.

Fix for the TreeView / Horizontal Scrollbar Bug

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 28 Sep 2005 09:41 GMT
I'm searching for a good way to avoid the bug that a treeview displays
a horizontal scrollbar in non-XP style when you fill its nodes e.g. in
the constructor of your form.

This seems to work:

public class MyTreeView : System.Windows.Forms.TreeView
{
   //....

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
Category("Behavior")]
   [Localizable(true), MergableProperty(false)]
   public new TreeNodeCollection Nodes
   {
       get
       {
           if(!Created)
           {
               CreateControl();
           }
           return base.Nodes;
       }
   }
}

Since i'm not to much into the Win32-API and its messages i would
appreciate if you could give me some advise whether to stick with that
or not. Are there any problems with such a simple modification or will
it just work. The other workaround is to not to fill the treeview
before the Form Load is fired but that has it's other problems (like
when i want to fill a control with data before i show it).

Thx in advance,
Daniel

For refernce some older thread on the topic:
http://groups.google.de/group/microsoft.public.dotnet.languages.csharp/browse_fr
m/thread/4674e2b02df3acba/2e6d3911183987ba#2e6d3911183987ba

Herfried K. Wagner [MVP] - 28 Sep 2005 12:22 GMT
"Daniel" <d.kress@gmx.net> schrieb:
> I'm searching for a good way to avoid the bug that a treeview displays
> a horizontal scrollbar in non-XP style when you fill its nodes e.g. in
> the constructor of your form.

<URL:http://groups.google.de/group/microsoft.public.dotnet.languages.csharp/browse_fr
m/thread/4674e2b02df3acba/2e6d3911183987ba#2e6d3911183987ba
>

The bug will be fixed in .NET 2.0's treeview control.

Signature

M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.