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

    CopyMemory DrawInfo, ByVal lParam, Len(DrawInfo)

    If DrawInfo.CtlType = ODT_MENU Then

        SetBkMode DrawInfo.hdc, TRANSPARENT

       

        '''' 初始化菜单项矩形, 图标矩形, 文字矩形

        itemRect = DrawInfo.rcItem

        iconRect = DrawInfo.rcItem

        textRect = DrawInfo.rcItem

       

        '''' 设置菜单附加条矩形

        With barRect

            .Left = 0

            .Top = 0

            .Right = BarWidth - 1

            For i = 0 To GetMenuItemCount(hMenu) - 1

                If MyItemInfo(i).itemType = MIT_SEPARATOR Then

                    .Bottom = .Bottom + 6

                Else

                    .Bottom = .Bottom + MeasureInfo.itemHeight

                End If

            Next i

            .Bottom = .Bottom - 1

        End With

       

        '''' 设置图标矩形, 文字矩形

        If BarStyle <> LBS_NONE Then iconRect.Left = barRect.Right + 2

        iconRect.Right = iconRect.Left + 20

        textRect.Left = iconRect.Right + 3

        

        With DrawInfo

       

            '''' 画菜单背景

            itemRect.Left = barRect.Right

            hBrush = CreateSolidBrush(BkColor)

            FillRect .hdc, itemRect, hBrush

            DeleteObject hBrush

 

       

            '''' 画菜单左边的附加条

            Dim RedArea As Long, GreenArea As Long, BlueArea As Long

            Dim red As Long, green As Long, blue As Long

            Select Case BarStyle

                Case LBS_NONE                                           '''' 无附加条

 

                Case LBS_SOLIDCOLOR                                     '''' 实色填充

 

                    hBrush = CreateSolidBrush(BarStartColor)

                    FillRect .hdc, barRect, hBrush

                    DeleteObject hBrush

 

                Case LBS_HORIZONTALCOLOR                                '''' 水平过渡色

 

                    BlueArea = Int(BarEndColor / &H10000) - Int(BarStartColor / &H10000)

                    GreenArea = (Int(BarEndColor / &H100) And &HFF) - (Int(BarStartColor / &H100) And &HFF)

           

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 

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