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

                        If MyItemInfo(.itemID).itemType <> MIT_CHECKBOX Then

                            DrawIconEx .hdc, iconRect.Left + 2, iconRect.Top + (iconRect.Bottom - iconRect.Top + 1 - 16) / 2, MyItemInfo(.itemID).itemIcon, 16, 16, 0, 0, DI_NORMAL

                        Else

                            If MyItemInfo(.itemID).itemState And MIS_CHECKED Then

                                DrawIconEx .hdc, iconRect.Left + 2, iconRect.Top + (iconRect.Bottom - iconRect.Top + 1 - 16) / 2, MyItemInfo(.itemID).itemIcon, 16, 16, 0, 0, DI_NORMAL

                            End If

                        End If

                   

                    End If

                Else                                                                 '''' 当菜单项不可用时

                   

                    '''' 画菜单项文字

                    SetTextColor .hdc, TextDisabledColor

                    DrawText .hdc, MyItemInfo(.itemID).itemText, -1, textRect, DT_SINGLELINE Or DT_LEFT Or DT_VCENTER

                   

                    '''' 画菜单项图标

                    If MyItemInfo(.itemID).itemType <> MIT_CHECKBOX Then

                        DrawState .hdc, 0, 0, MyItemInfo(.itemID).itemIcon, 0, iconRect.Left + 2, iconRect.Top + (iconRect.Bottom - iconRect.Top + 1 - 16) / 2, 0, 0, DST_ICON Or DSS_DISABLED

                    Else

                        If MyItemInfo(.itemID).itemState And MIS_CHECKED Then

                            DrawState .hdc, 0, 0, MyItemInfo(.itemID).itemIcon, 0, iconRect.Left + 2, iconRect.Top + (iconRect.Bottom - iconRect.Top + 1 - 16) / 2, 0, 0, DST_ICON Or DSS_DISABLED

                        End If

                    End If

                   

                End If

            End If

           

        End With

    End If

End Sub

 

'''' 菜单项事件响应(单击菜单项)

Private Sub MenuItemSelected(ByVal itemID As Long)

    Debug.Print "鼠标单击了:" & MyItemInfo(itemID).itemText

    Select Case MyItemInfo(itemID).itemAlias

        Case "exit"

            Dim frm As Form

            For Each frm In Forms

                Unload frm

            Next

    End Select

End Sub

 

'''' 菜单项事件响应(选择菜单项)

Private Sub MenuItemSelecting(ByVal itemID As Long)

    Debug.Print "鼠标移动到:" & MyItemInfo(itemID).itemText

End Sub

 << 上一页  [11] [12] [13] [14] [15] [16]  下一页

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