/*请教 下面的功能如何实现?给点意见*/

allenjiao 2010-10-05 10:43:48
本人要实现的功能是鼠标放在图标上弹出一个框;显示该图标的详细信息;
鼠标移开图标框消失


...全文
166 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
tangxianghenggood 2010-10-05
  • 打赏
  • 举报
回复
支持楼上哥们的
傻X 2010-10-05
  • 打赏
  • 举报
回复
tooltip bug众多,推荐神器cpptooltip,用了都说好,codeproject有下。
jacky_qiu 2010-10-05
  • 打赏
  • 举报
回复
用tooltip。
例子:
http://cid-3ba16e78a53d2d3d.office.live.com/self.aspx/VC%5EM%5EM/tooltip.zip

void func(HWND hWnd)
{
char szLongMessage[] =
"This message is a long message for the ToolTip that wraps automatically "
"when the length of the message 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.";


HINSTANCE inst = AfxGetInstanceHandle( );

TOOLINFO tinf;

HWND htip = CreateWindowEx(WS_EX_TOPMOST, _T("tooltips_class32"),
NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, 0, 0, 0, 0, hWnd, NULL, NULL, NULL);

tinf.cbSize = sizeof(TOOLINFO);
tinf.uFlags = TTF_SUBCLASS;
tinf.hwnd = hWnd;
tinf.hinst = inst;

// tip 00
tinf.uId = 0;
tinf.rect.left = 0;
tinf.rect.top = 0;
tinf.rect.right = 100;
tinf.rect.bottom = 100;
tinf.lpszText = szLongMessage;
::SendMessage(htip, TTM_ADDTOOL, 0, (LPARAM)&tinf);

// tip 01
tinf.uId = 1;
tinf.rect.left = 100;
tinf.rect.top = 0;
tinf.rect.right = 200;
tinf.rect.bottom = 100;
tinf.lpszText = _T("Mikoto");
::SendMessage(htip, TTM_ADDTOOL, 0, (LPARAM)&tinf);

//make tooltip show Multilines
::SendMessage(htip, TTM_SETMAXTIPWIDTH, 0, 300);
}

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧