VB打造超酷个性化菜单(三)(1)
设置菜单项状态Public Sub SetItemState(ByVal itemAlias As String, ByVal itemState As MenuItemState) Dim i As Long For i = 0 To UBound(MyItemInfo) If MyItemInfo(i).itemAlias = itemAlias Then MyItemInfo(i).itemState = itemState Dim ItemInfo As MENUITEMINFO With ItemInfo .cbSize = Len(ItemInfo) .fMask = MIIM_STRING Or MIIM_FTYPE Or MIIM_STATE Or MIIM_SUBMENU Or MIIM_ID Or MIIM_DATA End With GetMenuItemInfo hMenu, i, False, ItemInfo With ItemInfo .fState = .fState Or itemState End With SetMenuItemInfo hMenu, i, False, ItemInfo Exit For End If Next iEnd Sub ‘ 获得菜单项状态Public Function GetItemState(ByVal itemAlias As String) As MenuItemState Dim i As Long For i = 0 To UBound(MyItemInfo) If MyItemInfo(i).itemAlias = itemAlias Then GetItemState = MyItemInfo(i).itemState Exit For End If Next iEnd Function ‘ 属性: 菜单句柄Public Property Get hwnd() As Long hwnd = hMenuEnd Property Public Property Let hwnd(ByVal nValue As Long) End Property ‘ 属性: 菜单附加条宽度Public Property Get LeftBarWidth() As Long LeftBarWidth = BarWidthEnd Property Public Property Let LeftBarWidth(ByVal nBarWidth As Long) If nBarWidth >= 0 Then BarWidth = nBarWidth End IfEnd Property ‘ 属性: 菜单附加条风格Public Property Get LeftBarStyle() As MenuLeftBarStyle LeftBarStyle = BarStyleEnd Property Public Property Let LeftBarStyle(ByVal nBarStyle As MenuLeftBarStyle) If nBarStyle >= 0 And nBarStyle <= 4 Then BarStyle = nBarStyle End IfEnd Property ‘ 属性: 菜单附加条图像(只有当 LeftBarStyle 设置为 LBS_IMAGE 时才有效)Public Property Get LeftBarImage() As StdPicture Set LeftBarImage = BarImageEnd Property Public Property Let LeftBarImage(ByVal nBarImage As StdPicture) Set BarImage = nBarImageEnd Property ‘ 属性: 菜单附加条过渡色起始颜色(只有当 LeftBarStyle 设置为 LBS_HORIZONTALCOLOR 或 LBS_VERTICALCOLOR 时才有效)‘当 LeftBarStyle 设置为 LBS_SOLIDCOLOR (实色填充)时以 LeftBarStartColor 颜色为准Public Property Get LeftBarStartColor() As Long LeftBarStartColor = BarStartColorEnd Property Public Property Let LeftBarStartColor(ByVal nBarStartColor As Long) BarStartColor = nBarStartColorEnd Property ‘ 属性: 菜单附加条过渡色终止颜色(只有当 LeftBarStyle 设置为 LBS_HORIZONTALCOLOR 或 LBS_VERTICALCOLOR 时才有效)‘当 LeftBarStyle 设置为 LBS_SOLIDCOLOR (实色填充)时以 LeftBarStartColor 颜色为准Public Property Get LeftBarEndColor() As Long LeftBarEndColor = BarEndColorEnd Property Public Property Let LeftBarEndColor(ByVal nBarEndColor As Long) BarEndColor = nBarEndColorEnd Property ‘ 属性: 菜单项高亮条的范围Public Property Get ItemSelectScope() As MenuItemSelectScope ItemSelectScope = SelectScopeEnd Property Public Property Let ItemSelectScope(ByVal nSelectScope As MenuItemSelectScope) SelectScope = nSelectScopeEnd Property
首页 上页 | 1 | 2 | 下页 尾页 共 2 页