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/>