locked
Ownerdraw tooltips RRS feed

  • Question

  • This is my first post in any area here, so sorry if this is in the wrong area - if it is, can someone please redirect it to the right area?  Thanks.

    I am having trouble with "ownerdraw" tooltips.  I have them working just fine - except that the window that is popped up containing my owner drawn text, is permitted to partially be offscreen.  It looks as though the underlying .net code is positioning the window based upon the size of the tooltip.SetTooltip("junk string") call (which I had to do inorder to get tooltips to fire at all).  I am returning the proper size of the tooltip via the tooltip PopupEventHandler PopupEventArgs.ToolTipSize - and the tooltip window *is* the correct size, it is just always positioned as though the tooltip string were not ownerdrawn.

    Any ideas what I am doing wrong here and/or how I can get the tooltip window to properly reposition itself so that it is completely onscreen (if possible)?

    Thanks in advance,

    -Brian

     

    Friday, January 19, 2007 6:58 AM

Answers

  • You diagnosed this problem correctly.  The native Windows ToolTip has already determined where to put the window and how large to make it.  The framework code does take notice of the new size you return.  But cannot do much about it.  It only checks if the width has changed, then sends the native tooltip the TTS_SETMAXTIPWIDTH message.  That's meant to force the tooltip to wrap the text into multiple lines.  You might get a taller tooltip window (I haven't tried it), but it won't get wider. 

    Given the limitations of the native tooltip, there's not much you can do, other than adjusting your "junk string" to ensure you get a window that's large enough.

    Off topic for the CLR forum, moved to Windows Forms General.

    Friday, January 19, 2007 10:33 AM