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
MyMenucbSize = Len(MyMenu)
MyMenufMask = MIM_BACKGROUND Or MIM_APPLYTOSUBMENUS
MyMenuhbrBack = CreateSolidBrush(vbRed)
SetMenuInfo GetMenu(Mehwnd), MyMenu
End Sub
补充:事先在你的窗体里要先添加一个菜单才行。这个代码是让菜单变成红色,你可以任意设定。
vbd出菜单怎么制作啊?1首先设置好想要用的页面。这种一般是ios系统的自带页面,如果不小心就会被用户拉偏。但是也不失为一种好的选择。比如下面的这张图就是很细致的拉出文字的。2然后我们来添加一些阴影。可以把其中的一个小的文字设置的大一些,也可以设置的小一些。3然后我们点击文字,选择--调整--色彩。这样导出来的会比较的立体,有一种立体的感觉。4然后把上面的这个小的文字图层,换个颜色,放到色彩上面。这样就会制作出一张具有立体感的效果的背景啦。5接下来我们在上面的那一层图层就可以设置的色板或者的图标。这样做之后,我们就可以进行一些效果的处理啦。比如部分。
用菜单编辑器设计菜单,然后在空间的右键按下事件中写入代码,例如:Private Sub 控件名_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = MouseButtonConstantsvbRightButton Then
PopupMenu mymenu, 标志, X, Y, 默认菜单(即加粗的菜单项)
End If
End Sub
如果要隐藏部分菜单项,可以在popupmenu之前设置菜单的属性,例如
mymenuvisible=false
mymenuenabled=false
然后在d出菜单后再恢复原属性
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)