如何使用工具栏中的按钮工具提示功能? [英] how to use tooltips function for buttons in toolbar?
本文介绍了如何使用工具栏中的按钮工具提示功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨感谢阅读此quetion.i已使用createwindowex api创建工具栏。并且TBSTYLE_TOOLTIPS样式被指定为toolbar.then我发送TB_ADDBUTTONS消息以在工具栏中创建一个按钮。这些都没有问题。但是工具提示函数无效。源代码如下。
hi thank for read this quetion.i have used createwindowex api to create a toolbar.and the TBSTYLE_TOOLTIPS style was specified to toolbar.then i send TB_ADDBUTTONS message to create a button in toolbar.These all are no problem.But the tooltip function is invalid.The source code is as follows.
//create toolbar
HWND CreateBar(HWND pare_wnd)
{
INITCOMMONCONTROLSEX P;
P.dwSize = sizeof(P);
P.dwICC = ICC_BAR_CLASSES;
if (InitCommonControlsEx(&P))
{
//MessageBoxA(NULL,"加载控件库成功!",NULL,MB_OK);
}
else
MessageBoxA(NULL,"加载控件库失败!",NULL,MB_OK);
HWND toolbar;
RECT rt;
GetClientRect(pare_wnd,&rt);
toolbar = CreateWindowEx(WS_EX_CLIENTEDGE,
TOOLBARCLASSNAME,
NULL,
WS_CHILD |WS_VISIBLE|TBSTYLE_TOOLTIPS|TBSTYLE_TRANSPARENT , //specify tooltips style
rt.left,
rt.top,
0,
0,
pare_wnd,
(HMENU)NULL,
hInst,
NULL);
if (toolbar == NULL)
{
MessageBoxA(NULL,"","",MB_OK);
}
return toolbar;
}
//add button to toolbar
TBBUTTON arr[1];
arr[0].iBitmap = I_IMAGENONE;
arr[0].idCommand = IDM_ABOUT;
arr[0].fsState = TBSTATE_ENABLED ;
arr[0].fsStyle = BTNS_CHECK ;
arr[0].dwData = 0;
arr[0].iString = IS_INTRESOURCE(IDS_STRING129);
SendMessage(toolbar,TB_BUTTONSTRUCTSIZE ,(WPARAM)(int)size,0);
SendMessage(toolbar,TB_ADDBUTTONS,1,(LPARAM) (LPTBBUTTON)arr);
推荐答案
参见如何显示按钮的工具提示 [ ^ ]。
这篇关于如何使用工具栏中的按钮工具提示功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文