在vb中怎么禁用菜单栏的内容
答案:2 悬赏:70 手机版
解决时间 2021-03-09 05:13
- 提问者网友:趣果有间
- 2021-03-08 06:31
就是菜单里有很多子菜单,我用代码想禁用一部分,
最佳答案
- 五星知识达人网友:醉吻情书
- 2021-03-08 06:38
.Enable=False
全部回答
- 1楼网友:雾月
- 2021-03-08 08:04
private const mim_background = &h2
private const mim_applytosubmenus = &h80000000
private type menuinfo
cbsize as long
fmask as long
dwstyle as long
cymax as long
hbrback as long
dwcontexthelpid as long
dwmenudata as long
end type
private declare function getmenuinfo _
lib "user32" (byval hmenu as long, _
mi as menuinfo) as long
private declare function setmenuinfo _
lib "user32" (byval hmenu as long, _
mi as menuinfo) as long
private declare function getmenu lib "user32" (byval hwnd as long) as long
private declare function createsolidbrush lib "gdi32" (byval crcolor as long) as long
private sub form_load()
dim mymenu as menuinfo
mymenu.cbsize = len(mymenu)
mymenu.fmask = mim_background or mim_applytosubmenus
mymenu.hbrback = createsolidbrush(vbred)
setmenuinfo getmenu(me.hwnd), mymenu
end sub
补充:事先在你的窗体里要先添加一个菜单才行。这个代码是让菜单变成红色,你可以任意设定。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯