是否有可能使Windows多行黄色工具提示?
我尝试了n但它不工作。
编辑:
Windowsapp store应用多行文本框新行
为什么多行string在打印或写入时被改变? (Windows上的Python 3.6)
Sed – 如何在多行打印正则expression式组?
一个bashvariables可以是多行吗?
通过Windows批处理从svnlook获取日志消息
这是我在我的代码中的function。 我遵循MSDN的指示,但不能得到它的工作(看评论:/ / // Multiline tooltip )。
void CreatetoolTipForRect(HWND hwndParent) { if (!bCanCreatetoolTips) return; // Get list of areas we want tooltips on NSUI::TButton* tbt; tbt = gUserInterface->buttonList; HWND hwndTT; // Array to store all tooltip texts static char string[100][ RM_SCROLLTEXT_MAXLEN + 2 ]; // Go through the list while (tbt != NULL) { // Check id there is a tooltip text defined for this area int sid = GetResourceIdFromButtonId(tbt->id); if (sid == -1) { tbt = tbt->next; continue; } if (!ttwnd[tbt->id]) { // Create a ToolTip. hwndTT = CreateWindowEx(WS_EX_TOPMOST,TOOLTIPS_CLASS,NULL,WS_POPUP | TTS_nopREFIX | TTS_ALWAYSTIP,CW_USEDEFAULT,hwndParent,(( QunicApp * )CQMainGetApp())->CQWinApp_GetHInst(),NULL); ttwnd[tbt->id] = hwndTT; SetwindowPos(hwndTT,HWND_TOPMOST,SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); // Get tooltip from resources int res = LoadString((( QunicApp * )CQMainGetApp())->CQWinApp_GetHInst(),sid,string[tbt->id],RM_SCROLLTEXT_MAXLEN ); } // Set up "tool" @R_715_4045@ion. TOOLINFO ti = { 0 }; ti.cbSize = sizeof(TOOLINFO); ti.uFlags = TTF_SUBCLASS; ti.hwnd = hwndParent; ti.hinst = (( QunicApp * )CQMainGetApp())->CQWinApp_GetHInst(); ti.lpszText = string[tbt->id]; // Set area ti.rect.left = tbt->tx; ti.rect.right = tbt->bx; ti.rect.top = tbt->ty; ti.rect.bottom = tbt->by; // Associate the ToolTip with the "tool" window. SendMessage(ttwnd[tbt->id],TTM_ADDTOOL,(LParaM) (LPTOOLINFO) &ti); // Multiline tooltip - Ilija tried with this /*LPNMTTdisPINFO pInfo = (LPNMTTdisPINFO)tbt; SendMessage(pInfo->hdr.hwndFrom,TTM_SETMAXTipwIDTH,150);*/ tbt = tbt->next; } // Extra one,area or button is not kNown yet // Create a ToolTip. hwndTT = CreateWindowEx(WS_EX_TOPMOST,NULL); SetwindowPos(hwndTT,SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); // Set up "tool" @R_715_4045@ion. TOOLINFO ti = { 0 }; ti.cbSize = sizeof(TOOLINFO); ti.uFlags = TTF_SUBCLASS; ti.hwnd = hwndParent; ti.hinst = (( QunicApp * )CQMainGetApp())->CQWinApp_GetHInst(); // Get tooltip from resources int res = LoadString( ti.hinst,IDS_PREVIEW,string[99],RM_SCROLLTEXT_MAXLEN ); ti.lpszText = string[99]; // Set area ti.rect.left = 7; ti.rect.right = 104; ti.rect.top = 131; ti.rect.bottom = 145; // Associate the ToolTip with the "tool" window. SendMessage(hwndTT,(LParaM) (LPTOOLINFO) &ti); }
谢谢,
伊利亚·
Perl的/ m正则expression式修饰符在Windows上匹配不同吗?
如何更新刷子上多线的标记?
如何防止多行模式下的编辑控件隐藏部分文本行?
有3种工具提示。 您的屏幕截图显示了一个跟踪工具提示。 然后有一个多行工具提示,发送TTM_SETMAXTipwIDTH并响应TTN_GETdisPINFO。 并有气球工具提示,指定TTS_BALLOON窗口样式标志。 后两个适合你的账单。
您可以使用以下技巧强制标准工具提示控制执行多行:
在您的TTN_NEEDTEXT处理程序中:
// force multi-line tool tips ::SendMessage(pNMHDR->hwndFrom,kToolTipwidth);
无论如何,通过设置宽度,然后我可以绘制muiltiline提示:
pToolTipText->lpszText = _T("blah blah blahrnmore blah blahrnline 3 of blah");
其中kToolTipwidth是一些有用的最大宽度,比如600-800。
奇怪的是,我不得不在TTN_NEEDTEXT处理程序中重新发布此消息,而不仅仅是在创建窗口时。 在我们的MFC应用程序中,MFC使用每个线程的全局工具提示控件,这在每次创建新对话时都可能重置为默认值。 所以对于一个非MFC的应用程序,你可能只需要初始化一次。
请享用!
Windows使用rn换行符。 试试吧,它应该工作。 请参阅MSDN 。
我发现 n适用于正常的工具提示,但 n和 r n都不适用于工具提示。 我不使用Unicode。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。