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);
}
经过研究发现在xp系统下能却表现出黑色背景红色字体:
经过多方查证,发现是风格的问题,注释掉
stdafx.h中下段代码
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
注释掉该段代码后,就能设置成相应的背景色和文字色,但是自绘进度条这些会出现矩形边框:
并且tooltips的形状不是我想要的圆角矩形:
在这种情况下 我还是选择了不注释上段代码,其他方法还在研究当中,希望大家指点指点,然后继续更新,谢谢