Custom Tooltip Formatting

纵饮孤独 提交于 2019-12-11 07:49:33

问题


I am working in plain old native C on Windows. No other platforms, no C++. (Yes, I'm a dinosaur.)

I am trying to find an example of what I think of as an "owner draw tooltip control" but that does not appear to exist. At least not for the standard Windows tooltip control. I have tried to search for a library or source that implements a custom tooltip control, but all I can find is things that extend controls in .NET (or in other environments that are not where I am working.)

My hope is to support markdown (or something like it) for the text in the tooltip window. Mostly, I want to clearly differentiate the title from the content, and have some limited formatting of the content (bold, italics, color, and columns, mostly.)

I don't expect a full solution here, I am just hoping that someone else has already found a solution and can point me to where they found it. Please?


回答1:


Tooltips cannot be owner drawn, but they can be "custom drawn".

Custom drawn Win32 controls allow you to override the built-in drawing by receiving and responding to the NM_CUSTOMDRAW notification. You can read about custom draw here.

You can refer to the specific documentation on the tooltip control, see:

NM_CUSTOMDRAW (tooltip) notification code

Finally, here is a good tutorial demonstrating the whole thing in C.



来源:https://stackoverflow.com/questions/56583767/custom-tooltip-formatting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!