如何在单选按钮组中的单个单选按钮上显示工具提示? [英] How to show tooltip on individual radio button in radio button group?

查看:96
本文介绍了如何在单选按钮组中的单个单选按钮上显示工具提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在类级别上声明"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);
...


这篇关于如何在单选按钮组中的单个单选按钮上显示工具提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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