Results 1 to 3 of 3

Thread: ToolTip on TreeNode

  1. #1

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    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.

  2. #2
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476

    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

  3. #3

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    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
  •  



Click Here to Expand Forum to Full Width