15,979
社区成员
发帖
与我相关
我的任务
分享
CToolTipCtrl m_toolTip;
m_toolTip.Create(this,TTS_ALWAYSTIP );
m_toolTip.Activate(true);
m_toolTip.SetMaxTipWidth(100);
m_toolTip.AddTool(GetDlgItem(IDC_FORWARD), _T("快进"));
m_toolTip.SetTipBkColor(RGB(0,0,0));
m_toolTip.SetTipTextColor(RGB(255,0,0));
cor=m_toolTip.GetTipBkColor();
int r=GetRValue(cor);
int g=GetGValue(cor);
int b=GetBValue(cor);
cor=m_toolTip.GetTipTextColor();
r=GetRValue(cor);
g=GetGValue(cor);
b=GetBValue(cor);
CToolTipCtrl m_toolTip;
BOOL CtesttooltipDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
// 执行此操作
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
// TODO: 在此添加额外的初始化代码
m_toolTip.Create(this,TTS_ALWAYSTIP );
m_toolTip.Activate(true);
m_toolTip.SetMaxTipWidth(100);
m_toolTip.AddTool(GetDlgItem(IDC_BUTTON1), _T("快进"));
m_toolTip.SetTipBkColor(RGB(0,0,0));
m_toolTip.SetTipTextColor(RGB(255,0,0));
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
BOOL CtesttooltipDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: 在此添加专用代码和/或调用基类
/*if (pMsg->message == WM_MOUSEMOVE || pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONUP)
m_toolTip.RelayEvent(pMsg);*/
if(m_toolTip.m_hWnd)
{
m_toolTip.RelayEvent(pMsg);
}
return CDialog::PreTranslateMessage(pMsg);
}
CToolTipCtrl m_toolTip; // 成员函数
BOOL CXXXXDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// ...
m_toolTip.Create(this,TTS_ALWAYSTIP);//创建一个CToolTipCtrl对象
m_toolTip.Activate(true);
m_toolTip.SetMaxTipWidth(100);
m_toolTip.AddTool(this, _T("快进"));
m_toolTip.SetTipBkColor(RGB(0,0,0));
m_toolTip.SetTipTextColor(RGB(255,0,0));
return TRUE; // return TRUE unless you set the focus to a control
}
BOOL CXXXXDlg::PreTranslateMessage(MSG* pMsg)
{
if(m_toolTip.m_hWnd)
{
m_toolTip.RelayEvent(pMsg);
}
return CDialog::PreTranslateMessage(pMsg);
}