使用GDI +绘制工具提示 [英] Using GDI+ to draw tooltip

查看:88
本文介绍了使用GDI +绘制工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是GDI +编程的新手,正在寻求一些建议.

I'm new to GDI+ programming and am looking for some advice.

我正在从文件加载图像并使用以下功能(包括一些伪代码)显示它:

I am loading an image from a file and displaying it using the following functions (some pseudo code included):

Gdiplus::Image *i = new Gdiplus::Image(file, other parameters ... );
Gdiplus::DrawImage(i, other parameters ... );

我想将工具提示与图像相关联.有什么方法可以自动将工具提示设置/附加到Gdiplus :: Image对象(或我想为此绘制的任何其他Gdiplus控件)?

I would like to associate a tooltip with the image. Is there any way that I can automatically set/attach a tooltip to the Gdiplus::Image objact (or any other Gdiplus control that I wish to draw for that matter)?

如果没有,如何实现这种功能?我已经看过WTL中的CToolTipCtrl,但不知道如何将其附加到Gdiplus :: Image.

If not, how can such functionality be achieved? I have looked at CToolTipCtrl in WTL but don't know how to attach it to the Gdiplus::Image.

谢谢.

推荐答案

在进一步研究之后,我意识到这是不可能的.您必须使用GDI +绘制自己的工具提示,以监视鼠标事件以查看其何时悬停在某物上,然后使用设备上下文与鼠标悬停事件处理程序一起进行绘制.

After investigating this more, I've realised that this is not possible, so to speak. You must use GDI+ to draw your own tool tip my monitoring mouse events to see when it is hovering over something, then using the device context to do the drawing withing the mouse hover event handler.

这篇关于使用GDI +绘制工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆