问题描述
大家好!
我想首先感谢所有花时间查看此主题并尝试提供帮助的人。
我有一个弹出菜单,带子菜单。子菜单的项目应该有按钮而不是文本。
这就是它。
应该我的主人画了吗?
如果是这样,一些代码示例/伪代码/说明/教程/链接...将是受欢迎的。
更新#2:
**************************** ************************************************** *********
如何在WM_DRAWITEM中创建一个简单的按钮?
我尝试使用以下代码:
Hello everyone!
I would like to start by saying thanks to everyone who takes some time to view this thread and try to help.
I have a popup menu, with submenu. The submenu's item should have push button instead of text.
That is pretty much it.
Should I owner draw it?
If so, some code example/ pseudo-code / instructions / tutorials / links ... would be welcome.
UPDATE #2:
***************************************************************************************
How can I create a simple push button in WM_DRAWITEM ?
I have tried with following code:
LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)lParam;
HWND btnOk = CreateWindowEx(0,L"Button",L"test", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, lpDIS->rcItem.left + 10, lpDIS->rcItem.top + 10,
lpDIS->rcItem.right - lpDIS->rcItem.left - 20,
lpDIS->rcItem.bottom - lpDIS->rcItem.top - 20,
hwnd, NULL, hInst, 0);
我不知道将什么传递给CreateWindowEx()作为父窗口的参数。
该按钮正确显示为子窗口(无边框) ),它的尺寸很好,但它是主窗口的一个孩子,而不是菜单项。
如何将它作为菜单项的一部分?
这是唯一剩下的东西。
有人请帮我一些说明或代码示例或无论如何...
谢谢。
********************************************** *********************************************
更新#3:
是否可能没有人知道如何使用简单的按钮创建菜单项?
请有人帮助我,我一直试图靠近一个月没有成功这样做...
我我很绝望。
************************************** ************************************************** ****
我在MS Visual Studio Express 2008,Windows XP,C ++中使用纯WIN32 API。
如果任何其他信息是必需的(源代码或类似的东西),请求它,我将非常乐意提供它。
I don't know what to pass to CreateWindowEx() as parameter for parent window.
The button displays properly as a child window ( no border ), and its dimensions are good, but it is a child of the main window, not menu item.
How can I make it a part of the menu item ?
This is the only thing left.
Somebody please help me with some instructions or code examples or whatever...
Thank you.
*******************************************************************************************
UPDATE #3:
Is it possible that nobody knows how to create menu item with a simple push button in it?
Somebody help me please, I've been trying to do this on my own without success for nearly a month...
I am getting desperate.
********************************************************************************************
I work in MS Visual Studio Express 2008, on Windows XP, in C++, using pure WIN32 API.
If any other information is required ( source code or something similar ), please ask for it, I will more than gladly supply it.
推荐答案
LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)lParam;
lpDIS->hwndItem; // This will be the menu handle to be used as the parent.
对于所有者绘制的菜单,请查看此页面 - []
这篇关于如何在菜单项中添加按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!