Microsoft .net framework 2.0 treeview bug

Add comments

Under some circumstances the windows forms treeview control of the new microsoft .net framework 2.0 does not display the last node!

A very simple example can demonstrate this behavior on windows xp professional with service pack 2 (maybe on other platforms, too). Create a windows application with a treeview and a button on it. Set the anchor of the treeview to all sides and add the following code:

private void Form1_Load(object sender, EventArgs e)
for (int i = 0; i < 25; i++) this.treeView1.Nodes.Add(i + " xxxxxxxxxxxxxxxxxxxxxxxxx"); } private void button1_Click(object sender, EventArgs e) { this.treeView1.Nodes[24].EnsureVisible(); }

When you start this application and scroll down to the end of the treeview you can see this picture:
The node with the number 24 is missing but the lines of the tree shows that there is another node after 23.

If you resize the form parts of the missing note becomes visible but at the moment it could be full visible it will be hidden again.

The EnsureVisible-method of the last node does work neither.

I found a workaround. Just remove the Application.EnableVisualStyles() line in the main() function. Without visual styles enabled it works fine. But I want to use these styles...

Comments are closed.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in