views:

127

answers:

0

I am creating a user control derived from RichTextBox.

I have to display a tooltip under a custom hyperlink

I have created the cusom hyperlink ,with CFM_LINK .

Now when I do a mouse hover on the link , a tooltip should be displayed , with values respective to the link .

"I am using [Word2003] , but [Word2007] is the recent version. "

In my user control , words within brackets are treated as links. Therefore Word2003 and Word2007 is a link. I am creating this link using CFM_LINK.

Now I want to display a tooltip with the file properties , when the mouse hovers on a link, say , if the mouse hovers over [Word2003] , the tooltip shall display the Version No.

I am providing the code below ; this code should display the tooltip for the entire richtext box, whenver the mouse moves.

By the way, I have not set the event mask, for EN_LINK, is it necesary, as I am creating the link with CFM_LINK.

protected override void OnNotifyMessage(Message m) { base.OnNotifyMessage(m);

 NMHDR nmhdr = (NMHDR)Marshal.PtrToStructure(m.LParam, 
                                                        typeof(NMHDR));

 if(nmhdr.code == EN_LINK)
 {

      ENLINK linkStruct = (ENLINK)Marshal.PtrToStructure(m.LParam,typeof(ENLINK));

      if(linkStruct.msg == WM_MOUSEMOVE)
      {
            myToolTip.Active = true;
            myToolTip.SetToolTip(this, "This is my tooltip");
      }
      else
      {
            myToolTip.Active = false;
      }


 }

}

Please let me know what I am missing out .

Thank, Sujay