打印本文 打印本文 关闭窗口 关闭窗口
VB打造超酷个性化菜单(二)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数4136  更新时间:2009/4/23 15:44:34  文章录入:mintao  责任编辑:mintao
       End If

    Next i

End Sub

 

'''' 获得菜单项文字

Public Function GetItemText(ByVal itemAlias As String) As String

    Dim i As Long

    For i = 0 To UBound(MyItemInfo)

        If MyItemInfo(i).itemAlias = itemAlias Then

            GetItemText = MyItemInfo(i).itemText

            Exit For

        End If

    Next i

End Function

 

'''' 设置菜单项状态

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 i

End 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 i

End Function

 

'''' 属性: 菜单句柄

Public Property Get hwnd() As Long

    hwnd = hMenu

End Property

 

Public Property Let hwnd(ByVal nValue As Long)

 

End Property

 

'''' 属性: 菜单附加条宽度

Public Property Get LeftBarWidth() As Long

    LeftBarWidth = BarWidth

End Property

 

Public Property Let LeftBarWidth(ByVal nBarWidth As Long)

    If nBarWidth >= 0 Then

        BarWidth = nBarWidth

    End If

End Property

 

'''' 属性: 菜单附加条风格

Public Property Get LeftBarStyle() As MenuLeftBarStyle

    LeftBarStyle = BarStyle

End Property

 

Public Property Let LeftBarStyle(ByVal nBarStyle As MenuLeftBarStyle)

    If nBarStyle >= 0 And nBarStyle <= 4 Then

        BarStyle = nBarStyle

上一页  [1] [2] [3] [4] [5] [6] [7] [8]  下一页

打印本文 打印本文 关闭窗口 关闭窗口