windows 对话框列表控件的MFC tooltip

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6633881/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 17:22:08  来源:igfitidea点击:

MFC tooltip for list control of dialog box

c++windowswinapimfctooltip

提问by swapnil

I have developed on application, which shows a dialog box with two list controls. In this list control, I am showing images. Now I want is, when we move the mouse on images from the list control of dialog box, It will show tool tip for that.

我开发了应用程序,它显示了一个带有两个列表控件的对话框。在这个列表控件中,我正在显示图像。现在我想要的是,当我们将鼠标移动到对话框列表控件中的图像上时,它会显示工具提示。

How can I show tool tips for images in a list control in a dialog box?

如何在对话框的列表控件中显示图像的工具提示?

回答by Cody Gray

The CToolTipCtrlcontrolis the MFC wrapper class around the Win32 "tool tip". You can use this to display a small pop-up window to describe another control or provide additional information in your app.

CToolTipCtrl控件是围绕 Win32“工具提示”的 MFC 包装类。您可以使用它来显示一个小的弹出窗口来描述另一个控件或在您的应用程序中提供其他信息。

If you're using a ListBox control, explore one of these sample projects to see how to display tooltips for individual items displayed within that ListBox control:

如果您使用的是 ListBox 控件,请浏览以下示例项目之一,以了解如何为该 ListBox 控件中显示的各个项目显示工具提示:

And if you're using a ListView control (CListCtrlin MFC), then you should start by reading the documentation for the GetToolTipsfunctionand the corresponding SetToolTipsfunction. You can also check out how this sample ListView control implements tooltips:

如果您使用的是 ListView 控件(CListCtrl在 MFC 中),那么您应该首先阅读GetToolTips函数和相应SetToolTips函数的文档。您还可以查看此示例 ListView 控件如何实现工具提示: