|
-
Feb 11th, 2005, 05:01 PM
#1
Thread Starter
Frenzied Member
ToolTip on TreeNode
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?
Magiaus
If I helped give me some points.
-
Feb 12th, 2005, 03:09 AM
#2
Hyperactive Member
Re: ToolTip on TreeNode
Does that help?
Code:
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
}
}
}
Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Feb 12th, 2005, 11:16 AM
#3
Thread Starter
Frenzied Member
Re: ToolTip on TreeNode
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
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|