I think I have done this before I just don't remember how. I tried ToolTipExtender.SetToolTip(node, tip) but it fails because the node isn't a control.
Anyone know how to do this?
Printable View
I think I have done this before I just don't remember how. I tried ToolTipExtender.SetToolTip(node, tip) but it fails because the node isn't a control.
Anyone know how to do this?
Does that help?
StephanCode:private int oldNodeIndex = -1;
private ToolTip toolTip1;
private void Form1_Load(object sender, System.EventArgs e)
{
this.toolTip1 = new System.Windows.Forms.ToolTip();
this.toolTip1.InitialDelay = 300; //half a second delay
this.toolTip1.ReshowDelay = 0;
}
private void treeView1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
TreeNode tn = this.treeView1.GetNodeAt(e.X, e.Y);
if(tn != null)
{
int currentNodeIndex = tn.Index;
if(currentNodeIndex != oldNodeIndex)
{
oldNodeIndex = currentNodeIndex;
if(this.toolTip1 != null && this.toolTip1.Active)
this.toolTip1.Active = false; //turn it off
this.toolTip1.SetToolTip(this.treeView1, string.Format("tooltip: node {0}", oldNodeIndex));
this.toolTip1.Active = true; //make it active so it can show
}
}
}
Yeah, I get the idea behind this I was just hoping not to have to go that far.
Thanks though that looks like it will do the trick. I just wonder why a node isn't a control. I supose it's because it depends on the TreeView.
Thanks