Background http://msdn.microsoft.com/en-us/library/b17bescz(v=VS.90).aspx "The TVS_NOTOOLTIPS style disables the automatic tool tip feature of tree view controls. This feature automatically displays a tool tip, containing the title of the item under the mouse cursor, if the entire title is not currently visible."
Question: Where i开发者_开发百科s this default feature [i.e. whenever the item is cutoff, auto show tooltip of the title] of the CTreeCtrl actually implemented in the MFC code (e.g. which file)?
Thanks
The tooltip is inherent in the Win32 Tree Control. The CTreeCtrl is a simple wrapper. The only place to find the code for that is from Microsoft.
It should be relatively straightforward to implement this.
Capture mouse move in treectrl (OnMouseMove)
- Get current cursor position
- Get item under cursor (treectrl.HitTest)
- Get item's display rect (treectrl.GetItemRect)
- Get treectrl's display rect (treectrl.GetClientRect)
- If right side of item's display rect > treectrl's display rect --> SHOW TOOLTIP AT (item.left, item.top)
- If left side of item's display rect < treectrl's display rect --> SHOW TOOLTIP AT (treectrl.left, item.top)
Dunno if this helps. I do a very similar thing in an MFC app to do specialist highlighting.
精彩评论