使用CToolTipCtr提示信息l

1:创建对象

   CToolTipCtrl  m_toolTip;

   EnableToolTips(TRUE);
   m_toolTip.Create(this);
   m_toolTip.Activate(TRUE);

2:注册,以一个按钮为例

 CButton *pButton = (CButton*)GetDlgItem(IDC_BUTTON1);
 m_toolTip.AddTool(pButton,_T("矩形") );

3:重载pretranslatemassage

 添加 m_toolTip.RelayEvent(pMsg);   // Passes a mouse message to a tool tip control for processing.

以上是最简便的功能实现,具体参照MSDN

To create and manipulate a CToolTipCtrl

  1. Construct the CToolTipCtrl object.

  2. Call Create to create the Windows tool tip common control and attach it to the CToolTipCtrl object.

  3. Call AddTool to register a tool with the tool tip control, so that the information stored in the tool tip is displayed when the cursor is on the tool.

  4. Call SetToolInfo to set the information that a tool tip maintains for a tool.

  5. Call SetToolRect to set a new bounding rectangle for a tool.

  6. Call HitTest to test a point to determine whether it is within the bounding rectangle of the given tool and, if so, retrieve information about the tool.

  7. Call GetToolCount to retrieve a count of the tools registered with the tool tip control.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值