如何将ToolTip显示的提示文字分多行显示
解决方案 »
- 在窗口上一个矩形区域贴了一个图片,实现了用鼠标按住图片可以拖动图片的功能,但是图片移动速度跟不上鼠标移动速度,为什么?
- HTTP/1.1 200 OK为什么得到的想要的页面代码而是text/javascript代码
- 求:vc 6.0专业版
- 请问VC6中的project->dependencies菜单有什么用?
- 在RichEditCtrl中,如果我想將顯示和數据分開,但是又要同步,怎做呢?謝謝!
- 能不能在动态链接库里使用其他dll中的函数?
- 关于NETRESOURCE的问题
- &&&&&&&&&一个和数据库及clistctrl有关的问题&&&&&&&&
- 请问谁有ip phone的资料,我想看一下,谢谢~~
- 怎样开发一个输入法
- 哪位高手有关于映射模式的缩放例子?
- 如何对进程监控!
首先SetMaxTipWidth()
然后只加\n就可以!
看看这一段参考
Multiline ToolTips
Multiline ToolTips allow text to be displayed on more than one line. They are supported by version 4.70 and later of the common controls. Your application creates a multiline ToolTip by responding to a TTN_GETDISPINFO notification message. To force the ToolTip control to use multiple lines, send a TTM_SETMAXTIPWIDTH message, specifying the width of the display rectangle. Text that exceeds this width will wrap to the next line rather than widening the display region. The rectangle height will be increased as needed to accommodate the additional lines. The ToolTip control will wrap the lines automatically, or you can use a carriage return/line feed combination, \r\n, to force line breaks at particular locations.Note that the text buffer specified by the szText member of the NMTTDISPINFO structure can accommodate only 80 characters. If you need to use a longer string, point the lpszText member of NMTTDISPINFO to a buffer containing the desired text.The following code fragment is an example of a simple TTN_GETDISPINFO notification handler. It creates a multiline ToolTip by setting the display rectangle to 300 pixels and setting the lpszText member of NMTTDISPINFO to point to a buffer with the desired text.Example
char szLongMessage[ ] =
"This is a long message for the ToolTip, which will automatically "
"be wrapped when it exceeds the maximum tip width. "
"Alternatively, you can use a \r\n"
"carriage return/line feed combination\r\n"
"to force line breaks at specific\r\n"
"locations.";switch (lpnmhdr->code) {
case TTN_GETDISPINFO:
lpttd = (LPNMTTDISPINFO)lpnmhdr;
SendMessage(lpnmhdr->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 300);
lpttd->lpszText = szLongMessage;
return 0; ...
//Other notification handlers go here, as needed.
}