none
disable default / automatic tooltip .

    Question

  •  

    Hi all. (I resubmit this question , first try was no good).

     

    I’m using .Net 2.0 and the question is about tooltips.

    I’m assigning tooltip for each treenode in a treeview control by using a tooltip and call manually the show and hide methods to manipulate it (on the treeview mouse move event handler).

    When I have a long name node that spills over the form – I’m getting the “automatic” tooltip with the name of the node. The result is that I’m getting 2 tooltips for the same node (mine and the automatic one). This is reproducible with a simple standalone tree and a lond named node.

     

    How can I disable the automatic one (setting the ShowNodeTooltips property of the treeview doesn’t effect it) ?

     

    I wonder how one can control this “auto tooltip” properties.

    I’m missing something ?

    I did look at this post which is similar but with no answer … yet …

    Thanks

    Amit

    Tuesday, June 03, 2008 7:38 PM

Answers

  • Add a new class to your project and paste this code:

    using System;
    using System.Windows.Forms;

    public class MyTreeView : TreeView {
      protected override CreateParams CreateParams {
        get {
          CreateParams parms = base.CreateParams;
          parms.Style |= 0x80;  // Turn on TVS_NOTOOLTIPS
          return parms;
        }
      }
    }

    Compile.  Drag + drop the new control from the top of the toolbox onto your form.
    Wednesday, June 04, 2008 1:59 AM
    Moderator
  • You'd have to look at the MSDN library pages for the native TreeView control.  TVS_NOTOOLTIP is declared in the commctrl.h SDK header file.
    Wednesday, June 04, 2008 2:27 PM
    Moderator

All replies

  • Add a new class to your project and paste this code:

    using System;
    using System.Windows.Forms;

    public class MyTreeView : TreeView {
      protected override CreateParams CreateParams {
        get {
          CreateParams parms = base.CreateParams;
          parms.Style |= 0x80;  // Turn on TVS_NOTOOLTIPS
          return parms;
        }
      }
    }

    Compile.  Drag + drop the new control from the top of the toolbox onto your form.
    Wednesday, June 04, 2008 1:59 AM
    Moderator
  • Thanks nobugz , this is working !

     

    Naturally I tried to find more available options (this createparam and style are new to me) but the only list I found was in the winuser.h file (got there from here )  which is incomplete (the TVS_TOOLTIP you showed me is missing ) and is missing documentation.

    Do you know a source of documentation for these options ?

     

    Thanks again for your help

    Amit

     

    Wednesday, June 04, 2008 2:22 PM
  • You'd have to look at the MSDN library pages for the native TreeView control.  TVS_NOTOOLTIP is declared in the commctrl.h SDK header file.
    Wednesday, June 04, 2008 2:27 PM
    Moderator
  • Thanks again.

    Amit

     

    Wednesday, June 04, 2008 2:46 PM