简体   繁体   English

MFC CMenu 工具提示未显示

[英]MFC CMenu tooltip not being displayed

I tried using something like this to set the tool tip of a CMenu item (as described here ) but it is just being displayed in a single line and the line break is not visible.我尝试使用类似这样的东西来设置 CMenu 项的工具提示(如此所述),但它只是显示在一行中,并且换行符不可见。

// read control id
UINT id = menu->GetMenuItemID(1235);
// modify caption and add tooltip?
menu->ModifyMenu( id, MF_BYCOMMAND, id, "Click here\nThis is the tooltip for the menu item ...");

I also tried to set the caption directly in the visual studio resource designer of the menu item with the same effect.我也试过直接在菜单项的visual studio资源设计器中设置标题,效果一样。 Can you give me any hints on whats wrong?你能告诉我什么是错的吗? I am using VS2008 on windows 7.我在 windows 7 上使用 VS2008。

Any help is appreciated!任何帮助表示赞赏!

Looks like an duplicate 看起来像重复

Mainly you should use \r\n instead of \n because this is what mfc expects.主要你应该使用 \r\n 而不是 \n 因为这是 mfc 所期望的。

Perhaps you have not added the windows xp common controls to your application.也许您还没有将 windows xp 通用控件添加到您的应用程序中。

Try adding the common controls to your stdafx.h:尝试将常用控件添加到您的 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM