【发布时间】:2011-09-30 10:35:32
【问题描述】:
我尝试使用类似这样的方法来设置 CMenu 项的工具提示(如 here 所述),但它只是显示在一行中,并且换行符不可见。
// 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 ...");
我也试过直接在菜单项的visual studio资源设计器中设置标题,效果一样。 你能告诉我什么是错的吗?我在 Windows 7 上使用 VS2008。
感谢任何帮助!
【问题讨论】:
-
尝试在 Visual Studio 设计器中设置菜单属性中的文本。我不是 100% 清楚完整的上下文,但似乎这可能是 MFC 问题。
-
您是否也尝试过添加
MF_STRING位?例如。menu->ModifyMenu( id, MF_BYCOMMAND | MF_STRING, id, "Click here\nThis is the tooltip for the menu item ..."); -
感谢您的 cmets。 @JonathanWood:我已经尝试过了(请参阅我的原始帖子)并且效果相同。 @JonasGulle:MF_STRING 位也没有任何作用。
-
我认为 \r\n 可能会这样做。 MFC 总是\r\n
标签: c++ windows mfc tooltip cmenu