自定义工具提示格式 [英] Custom Tooltip Formatting
问题描述
我在 Windows 上使用普通的老式原生 C 语言.没有其他平台,没有 C++.(是的,我是一只恐龙.)
I am working in plain old native C on Windows. No other platforms, no C++. (Yes, I'm a dinosaur.)
我试图找到一个我认为是所有者绘制工具提示控件"的示例,但它似乎不存在.至少不是标准的 Windows 工具提示控件.我曾尝试搜索实现自定义工具提示控件的库或源,但我所能找到的只是在 .NET(或我不工作的其他环境中)中扩展控件的东西.
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?
推荐答案
工具提示不能由所有者绘制,但可以自定义绘制".
Tooltips cannot be owner drawn, but they can be "custom drawn".
自定义绘制的 Win32 控件允许您通过接收和响应 NM_CUSTOMDRAW
通知来覆盖内置绘图.您可以在此处阅读有关自定义绘图的信息.
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.
可以参考tooltip控件的具体文档,见:
You can refer to the specific documentation on the tooltip control, see:
最后,这里用 C 语言演示整个过程的教程.
Finally, here is a good tutorial demonstrating the whole thing in C.
这篇关于自定义工具提示格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!