Ugly Yellow Tooltips in your MFC Application Using the Windows 7 Theme

Posted by Matt | Filed under , , , ,

I found another bug in MFC in Visual Studio 2010, but it’s an easy one to fix.

If you create a new MFC Ribbon project and use the Windows 7 colour scheme, then you’ll notice that the tooltips are ugly and yellow.

image

If you want to get the attractive tooltips back, you need to add a little bit of code.  Pat Brenner gave a solution when I reported the problem on the MSDN Forums.  This solution will work if you are allowing theme switching in your application.  If you are not, then you need to add similar code, elsewhere.  If this is the case for you, add the following code to CMainFrame::OnCreate():

CMFCToolTipInfo ttParams;
ttParams.m_bVislManagerTheme = FALSE;
ttParams.m_bDrawSeparator = FALSE;
ttParams.m_clrFillGradient = afxGlobalData.clrBarFace;
ttParams.m_clrFill = RGB(255, 255, 255);
ttParams.m_clrBorder = afxGlobalData.clrBarShadow;
ttParams.m_clrText = afxGlobalData.clrBarText;
theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
  RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);

If you do this, you’ll get the attractive tooltips you’re looking for.

image

Comments

November 23, 2010 21:51

pingback

Pingback from nihonhakei.com

今日のお気に入り(Tooltips) /  æ—¥æœ¬æ³¢å½¢ by Kenji

nihonhakei.com

Comments are closed