CMFCButton :: EnableFullTextTooltip是做什么的? [英] What does CMFCButton::EnableFullTextTooltip do?

查看:156
本文介绍了CMFCButton :: EnableFullTextTooltip是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用CMFCButton工具提示,发现如果我调用EnableFullText(),则工具提示不会显示.

I was trying the CMFCButton tooltips and found that if I call EnableFullText() the tooltips don't show.

这里有一些示例:

// In OnInitDialog()
c_MyBtn.m_nFlatStyle = CMFCButton::BUTTONSTYLE_SEMIFLAT;
c_MyBtn.SetMouseCursorHand();
c_MyBtn.EnableFullTextTooltip();
c_MyBtn.SetTooltip(_T("Some string"));
c_MyBtn.Invalidate();

那么,该功能可以执行某些操作吗?文档说指定是在大型工具提示窗口中显示工具提示的全文,还是在小型工具提示窗口中显示文本的截断版本",但我唯一看到的是工具提示不显示.我已经尝试过长字符串和带换行符的字符串,但是什么也没有.

So, does that function do something? The docs say it "Specifies whether to display the full text of a tooltip in a large tooltip window or a truncated version of the text in a small tooltip window", but the only thing I see is that tooltips don't show. I've tried long strings and strings with line breaks, but nothing.

任何人都知道此功能的目的以及如何使用它吗?

Anyone knows the purpose of this function and how to use it?

我正在使用Visual Studio 2008 SP1.

I'm using Visual Studio 2008 SP1.

推荐答案

关于MFC的妙处是Microsoft为您提供了源代码.如有疑问,请看一下代码.

The wonderful thing about MFC is that Microsoft gives you the source. If there's ever a question, just look at the code.

看着EnableFullTextTooltip,它所做的只是设置了几个布尔标志.重要的是m_bDelayFullTextTooltipSet.在OnDraw函数中检查此标志.工具提示文本用SetTooltip设置:如果完整的按钮文本适合按钮本身,则使用NULL调用,否则使用按钮文本调用.

Looking at EnableFullTextTooltip, all it does is set a couple of boolean flags. The important one is m_bDelayFullTextTooltipSet. This flag is checked in the OnDraw function. The tooltip text is set with SetTooltip: if the full button text fits on the button itself, it's called with NULL, otherwise it's called with the button text.

此功能的目的是使工具提示显示按钮太小时应在按钮本身上绘制的文本.如果那不是您想要的,请避免使用此功能,因为它将覆盖您设置的工具提示.

It appears the intent of this function is to have the tooltip display the text that should have been drawn on the button itself when the button is too small. If that's not what you want, avoid this function because it will override the tooltip that you have set.

这篇关于CMFCButton :: EnableFullTextTooltip是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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