怎样添加按钮的提示?

whmjack 2003-08-31 12:08:56
我想在鼠标放置于按钮之上时显示按钮相关的信息提示,如”打开文件“,请问怎么下手呢?有相关的代码吗?谢谢!
...全文
68 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
bcpl 2003-08-31
  • 打赏
  • 举报
回复
1. 定义成员变量CToolTipCtrl m_tt
2. 用m_tt.AddTool(..)添加按钮提示
3. 在父窗口类的PreTranslateMessage中添加
m_tt.RelayEvent(pMsg);

例子程序
http://my.6to23.com/cigarette/dd8.zip
wangjs720 2003-08-31
  • 打赏
  • 举报
回复
class CToolTipCtrl : public CWnd
Remarks
The CToolTipCtrl class encapsulates the functionality of a "tool tip control," a small pop-up window that displays a single line of text describing the purpose of a tool in an application. A "tool" is either a window, such as a child window or control, or an application-defined rectangular area within a window's client area. A tool tip is hidden most of the time, appearing only when the user puts the cursor on a tool and leaves it there for approximately one-half second. The tool tip appears near the cursor and disappears when the user clicks a mouse button or moves the cursor off the tool.

CToolTipCtrl provides the functionality to control the initial time and duration of the tool tip, the margin widths surrounding the tool tip text, the width of the tool tip window itself, and the background and text color of the tool tip. A single tool tip control can provide information for more than one tool.

The CToolTipCtrl class provides the functionality of the Windows common tool tip control. This control (and therefore the CToolTipCtrl class) is available only to programs running under Windows 95/98 and Windows NT versions 3.51 and later.

For more information about enabling tool tips, see Tool Tips in Windows not Derived from CFrameWnd.

For more information on using CToolTipCtrl, see Controls and Using CToolTipCtrl.

Requirements
Header: afxcmn.h

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧