Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
A treeview control with panel nodes
Posted
Comments
HobbyProggy 21-May-15 5:49am    
Further information ? Have you tried anything?
Sinisa Hajnal 21-May-15 6:44am    
You'll have to explain in MUCH more detail before anyone can help you. First of all, web, winforms, WPF...then exactly what you are trying to accomplish
Ravi Bhavnani 21-May-15 10:38am    
What is a "panel" node? What technology are you using? WPF? Silverlight? WinForms? Web?

/ravi

1 solution

TreeView doesn't have a Scroll event. It isn't reliable anyway since nodes can be expanded and collapsed, changing the position and visibility of the node. Alternative is to use timer as below:

C#
private void timer1_Tick(object sender, EventArgs e) {
    var node = treeView1.SelectedNode;
    if (node == null || !node.IsVisible) panel1.Visible = false;
    else {
        panel1.Visible = true;
        var nodepos = treeView1.PointToScreen(node.Bounds.Location);
        var panelpos = panel1.Parent.PointToClient(nodepos);
        panel1.Top = panelpos.Y;
    }
}


It works well to clarify your requirement.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900