如何在单选按钮组中的单个单选按钮上显示工具提示?

编程入门 行业动态 更新时间:2024-10-28 08:20:14
本文介绍了如何在单选按钮组中的单个单选按钮上显示工具提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在类级别上声明"CToolTipCtrl m_clttcToolTip".

"CToolTipCtrl m_clttcToolTip" declared on class level.

BOOL CAdd::OnInitDialog() { CDialog::OnInitDialog(); m_ILRadio.SetCheck(1); m_clttcToolTip.Create(this); m_clttcToolTip.Activate(TRUE); m_clttcToolTip.SetTipBkColor(RGB(250,220,200)); m_clttcToolTip.AddTool(&m_ILRadio,"Setting tooltip for radio1"); m_clttcToolTip.AddTool(&m_ILRadio,"Setting tooltip for radio2"); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } BOOL CAddDict::PreTranslateMessage(MSG* pMsg) { m_clttcToolTip.RelayEvent(pMsg); return CDialogSK::PreTranslateMessage(pMsg); }

问题:我需要在单选按钮组中的单个单选按钮上显示工具提示.由于在类向导的组单选按钮中只能定义一个控制变量.

Problem:I need to show tooltip on individual radio button in radio button group.As only one control variable can be defined in group radio button in class wizard. How to set tooltip for each radio button?

推荐答案

据我所知,有两种方法. 首先是为每个单选按钮添加成员变量.这是可能的,因为它们具有不同的ID. There are two ways as far as I can tell. The first being adding member variables for each radio button. This is possible since they have different ID''s. m_clttcToolTip.AddTool(GetDlgItem(IDC_BT_1), "Setting tooltip for radio1"); m_clttcToolTip.AddTool(GetDlgItem(IDC_BT_2), "Setting tooltip for radio2");

或者您可以改用它们的矩形

or you could use their rectangles instead

CRect rc1; GetDlgItem(IDC_BT_1)->GetWindowRect(&rc1); ScreentToClient(rc1); m_clttcToolTip.AddTool(this, "Setting tooltip for radio1", &rc1); ...

更多推荐

如何在单选按钮组中的单个单选按钮上显示工具提示?

本文发布于:2023-11-03 16:58:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555625.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单选   按钮   组中   提示   工具

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!