如何在win32中更改工具栏按钮的位图?
我在窗口中使用 ReBar 创建了一个带有一些控件的工具栏。谁能告诉我,
- 如果我(仅)知道它的 ID,如何获取 buttons/combobox/etc (不是窗口中的普通按钮)的 HWND ?
- 如果我知道资源的 id,如何获取 HBITMAP?
如何将位图设置到控制器?
SendDlgItemMessageW(hWnd, nId, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap);
这不适用于工具栏,不是吗?我找不到办法,请帮助我。谢谢...
问候
编辑: 请问有人吗? :(
编辑: 好的。看来这几天大家都很忙。 :( 顺便说一句,这是一个错误的问题吗?
I have created a toolbar with some controls on it using ReBar within a window. Can anyone please tell me,
- How to get the HWND of a buttons/combobox/etc (not normal buttons in a window) if I know (only) the Id of it ?
- How to obtain the HBITMAP if I know the id of the resource ?
How to set the bitmap to the controller ?
SendDlgItemMessageW(hWnd, nId, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap);
This isn't working for toolbars, isn't it ? I couldn't find a way to do it, please help me. Thank you...
Regards
EDIT:
Anyone please ? :(
EDIT:
Ok. it seems everyone is busy these days. :( Btw, is it a wrong question ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以下载 ControlSpy 并在那里尝试来感受一下。
我检查了 Rebar,发现 RB_SETBANDINFO(在 Messages 下)可能就是您正在寻找的内容。
You could download ControlSpy and try it in there to get a feel for it.
I checked the Rebar and saw that RB_SETBANDINFO (under Messages) could be what you are looking for.
GetDlgItem 与 Rebar 的效果一样好就像对话框一样。
您可以使用 LoadImage 从资源加载位图并返回 HBITMAP。
最后,
SendMessage(hWndButton, BM_SETIMAGE, (WPARAM) IMAGE_BITMAP, (LPARAM) hBitmap);
GetDlgItem will work just as well with a Rebar as it does with a Dialog.
You can use LoadImage to load a bitmap from a resource and return the HBITMAP.
Finally,
SendMessage(hWndButton, BM_SETIMAGE, (WPARAM) IMAGE_BITMAP, (LPARAM) hBitmap);