⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xpframe.ctl

📁 XP风格浮动工具条 和苹果风格按钮控件
💻 CTL
📖 第 1 页 / 共 5 页
字号:
        If m_eContainerShapeStyle = Rounded Then
            lRadius = m_iContainerCornerRadius
        Else
            lRadius = 0
        End If

        lWinRgn = CreateRoundRectRgn(0, 0, .ScaleWidth, .ScaleHeight, lRadius, lRadius)
        GetItemWindowReg lWinRgn

        If m_XPStyle = False Then
            Label1.visible = False
            If m_UseCustomColors Then
                GetItemClientRect tR, 0, 0, .ScaleWidth, ScaleHeight
                tRB.lBottom = tR.bottom
                tRB.lLeft = tR.Left
                tRB.lRight = tR.Right
                tRB.lTop = tR.Top
                If m_bHeaderVisible Then
                    tRB.lTop = tRB.lTop + lHeaderSize - 2
                End If
                If m_bFooterVisible Then
                    tRB.lBottom = tRB.lBottom - lFooterSize
                End If
                
                DrawTopDownGradient .hdc, tRB, m_oContainerBackColor, m_oContainerFadeColor
                'UtilDrawBackground .hdc, m_oContainerBackColor, m_oContainerFadeColor, tR.Left, tR.Top, tR.Right - tR.Left, tR.Bottom - tR.Top, m_eContainerFillStyle
                'UserControl.BackColor = m_oContainerBackColor
                
                If m_bFooterVisible Then
                    GetItemClientRect tR, 0, .ScaleHeight - lFooterSize, .ScaleWidth - 1, ScaleHeight
                    UtilDrawBackground .hdc, m_oFooterBackColor, m_oFooterFadeColor, tR.Left, tR.Top, tR.Right, tR.bottom, m_eFooterFillStyle
                    DrawCaption tR, m_sFooterText, m_oFooterTextColor, m_fFooterTextFont, ValFooterTextAlign, False
                End If
    
                If m_bHeaderVisible Then
                    GetItemClientRect tR, 0, 1, .ScaleWidth - 2, lHeaderSize
                    UtilDrawBackground .hdc, m_oHeaderBackColor, m_oHeaderFadeColor, 0, 0, tR.Right, tR.bottom, m_eHeaderFillStyle
                    'If Not m_HeaderPicture Is Nothing Then
                    '    If HeaderPicture <> 0 Then
                            tR.Left = tR.Left + 3 + m_HeaderPictureSize
                            DrawCaption tR, m_sHeaderText, m_oHeaderTextColor, m_fHeaderTextFont, ValHeaderTextAlign, True
                    '    End If
                    'End If
                End If
    
    
                UserControl.ForeColor = m_oContainerBorderColor
    
                hPen = CreatePen(BorderStyle, 1, m_oContainerBorderColor)
                hPenOld = SelectObject(.hdc, hPen)
    
            Else
    
                GetItemClientRect tR, 0, 0, .ScaleWidth, .ScaleHeight
                'UtilDrawBackground mDC, m_lColorContainerColorOne, m_lColorContainerColorTwo, tR.Left, tR.Top, tR.Right, tR.Bottom, m_eContainerFillStyle
                tRB.lBottom = tR.bottom
                tRB.lLeft = tR.Left
                tRB.lRight = tR.Right
                tRB.lTop = tR.Top
                If m_bHeaderVisible Then
                    tRB.lTop = tRB.lTop + lHeaderSize - 2
                End If
                If m_bFooterVisible Then
                    tRB.lBottom = tRB.lBottom - lFooterSize
                End If
                
                DrawTopDownGradient .hdc, tRB, m_lColorContainerColorOne, m_lColorContainerColorTwo
                'UserControl.BackColor = m_lColorContainerColorOne
    
                If m_bFooterVisible Then
                    GetItemClientRect tR, 0, .ScaleHeight - lFooterSize, .ScaleWidth - 1, ScaleHeight
                    UtilDrawBackground .hdc, m_lColorFooterColorOne, m_lColorFooterColorTwo, tR.Left, tR.Top, tR.Right, tR.bottom, m_eFooterFillStyle
                    DrawCaption tR, m_sFooterText, m_lColorFooterForeColor, m_fFooterTextFont, ValFooterTextAlign, False
                End If
                
                If m_bHeaderVisible Then
                    GetItemClientRect tR, 0, 1, .ScaleWidth - 1, lHeaderSize
                    UtilDrawBackground .hdc, m_lColorHeaderColorOne, m_lColorHeaderColorTwo, 0, 0, tR.Right, tR.bottom, m_eHeaderFillStyle
    '                If Not m_HeaderPicture Is Nothing Then
    '                    If HeaderPicture <> 0 Then
                            tR.Left = tR.Left + 3 + m_HeaderPictureSize
                            DrawCaption tR, m_sHeaderText, m_lColorHeaderForeColor, m_fHeaderTextFont, ValHeaderTextAlign, True
    '                    End If
    '                End If
                End If
    
                UserControl.ForeColor = m_lColorContainerColorBorder
    
                hPen = CreatePen(BorderStyle, 1, m_lColorContainerColorBorder)
                hPenOld = SelectObject(.hdc, hPen)
            End If
    
            UtilDrawShapeStyle .hdc, 0, 0, .ScaleWidth - 1, .ScaleHeight - 1, lRadius
            SelectObject .hdc, hPenOld
            DeleteObject hPen
        Else
            UserControl.BackColor = RGB(236, 233, 216)
            
            hPen = CreatePen(BorderStyle, 1, RGB(208, 208, 191))
            hPenOld = SelectObject(.hdc, hPen)

            UtilDrawShapeStyle .hdc, 0, 4, .ScaleWidth - 1, .ScaleHeight - 1, 8
            SelectObject .hdc, hPenOld
            DeleteObject hPen

            Label1.Caption = m_sHeaderText
            Label1.Font = m_fHeaderTextFont
            Label1.ForeColor = RGB(0, 70, 213)
            Label1.visible = True
            Label1.Refresh
        End If
    End With

    'Header
    If m_bHeaderVisible And m_XPStyle = False Then
        If Not m_HeaderPicture Is Nothing And m_HeaderPictureVisible = True Then
            GetItemClientRect tR, 4, (lHeaderSize - m_HeaderPictureSize) / 2, m_HeaderPictureSize, lHeaderSize
            DrawPicture tR, m_HeaderPicture, m_HeaderPictureSize
        End If
        If m_CanExpand Then Call DrawChevron
    End If
    'Resizable
    If m_Resize = True And m_XPStyle = False And m_bFooterVisible = True And State = eBarcollapsed Then
        Call DrawResize
    End If
    'Closeable
    If m_cClose = True And m_XPStyle = False Then
        Call DrawClose
    End If
    'Container
    If Not m_ContainerPicture Is Nothing And m_ContainerPictureVisible = True And m_XPStyle = False Then
        Dim w As Long, h As Long, T As Long, L As Long
        w = UserControl.ScaleWidth: h = UserControl.ScaleHeight
        If m_bHeaderVisible Then h = h - lHeaderSize
        T = (UserControl.ScaleHeight - h) - m_TopBuffer
        h = h - m_TopBuffer - 2
        L = 4 + m_LeftBuffer
        w = w + m_LeftBuffer
        GetItemClientRect tR, L, UserControl.ScaleHeight - h, w, h
        DrawPicture tR, m_ContainerPicture, m_ContainerPictureSize
    End If
End Sub
Private Sub DrawControlQuick()
    Dim lWinRgn As Long
    Dim lRadius As Long

    With UserControl
        If m_eContainerShapeStyle = Rounded Then
            lRadius = m_iContainerCornerRadius
        Else
            lRadius = 0
        End If
        lWinRgn = CreateRoundRectRgn(0, 0, .ScaleWidth, .ScaleHeight, lRadius, lRadius)
        GetItemWindowReg lWinRgn
        If m_UseCustomColors Then
            UserControl.BackColor = m_oContainerBackColor
            UserControl.ForeColor = m_oContainerBackColor
        Else
            UserControl.BackColor = m_lColorContainerColorOne
            UserControl.ForeColor = m_lColorContainerColorOne
        End If
    End With
End Sub
Private Sub DrawCaption(ByRef rct As RECT, _
                        ByVal sCaption As String, _
                        ByVal lTextColor As OLE_COLOR, _
                        ByVal oTextFont As Font, _
                        ByVal Alignment As Long, head As Boolean)

    Dim AlignmentCushion As Integer
    Dim oColor As OLE_COLOR           '--couleur du texte du caption
    Dim bFnt As StdFont               '--police

    AlignmentCushion = 3

    Set bFnt = Font
    Set Font = oTextFont
    oColor = UserControl.ForeColor
    UserControl.ForeColor = lTextColor

    With rct
        .Left = .Left + AlignmentCushion
        .Top = .Top + AlignmentCushion - 1
        .Right = .Right - 3
        .bottom = .bottom - 1
    End With

    If head = True Then
        If m_CanExpand Then
            rct.Right = rct.Right - 20
        End If
        If m_cClose Then
            rct.Right = rct.Right - 20
        End If
        If m_HeaderPictureVisible = False Or m_HeaderPicture Is Nothing Then
            rct.Left = rct.Left - 18
        End If
    End If

    DrawText UserControl.hdc, sCaption, LenB(sCaption), rct, Alignment

    UserControl.ForeColor = oColor
    Set Font = bFnt
End Sub

'Gestion des diff閞ents th鑝es
Private Sub GetGradientColors()
    If Not m_UseCustomColors Then
        Select Case m_enmTheme
        Case xThemeDarkBlue
            m_lColorHeaderColorOne = RGB(137, 170, 224)
            m_lColorHeaderColorTwo = RGB(7, 33, 100)
            m_lColorHeaderForeColor = RGB(215, 230, 251)
            m_lColorCollapseButtonColor = RGB(172, 191, 227)
            '
            m_lColorFooterColorOne = RGB(9, 42, 127)
            m_lColorFooterColorTwo = RGB(102, 145, 215)
            m_lColorFooterForeColor = RGB(215, 230, 251)
            '
            m_lColorContainerColorOne = RGB(142, 179, 231)
            m_lColorContainerColorTwo = RGB(142, 179, 231)
            m_lColorContainerColorBorder = RGB(1, 45, 150)

        Case xThemeMediaPlayer
            m_lColorHeaderColorOne = RGB(216, 228, 248)
            m_lColorHeaderColorTwo = RGB(49, 106, 197)
            m_lColorHeaderForeColor = RGB(215, 230, 251)
            m_lColorCollapseButtonColor = RGB(65, 105, 225)
            '
            m_lColorFooterColorOne = RGB(49, 106, 197)
            m_lColorFooterColorTwo = RGB(211, 229, 250)
            m_lColorFooterForeColor = RGB(215, 230, 251)
            '
            m_lColorContainerColorOne = RGB(243, 255, 255)
            m_lColorContainerColorTwo = RGB(142, 179, 231)
            m_lColorContainerColorBorder = RGB(192, 211, 240)

        Case xThemeGreen
            m_lColorHeaderColorOne = RGB(228, 235, 200)
            m_lColorHeaderColorTwo = RGB(175, 194, 142)
            m_lColorHeaderForeColor = RGB(100, 144, 88)
            m_lColorCollapseButtonColor = RGB(143, 188, 139)

            m_lColorFooterColorOne = RGB(165, 182, 121)
            m_lColorFooterColorTwo = RGB(233, 244, 207)
            m_lColorFooterForeColor = RGB(215, 230, 251)

            m_lColorContainerColorOne = RGB(233, 244, 207)
            m_lColorContainerColorTwo = RGB(233, 244, 207)
            m_lColorContainerColorBorder = RGB(100, 144, 88)

        Case xThemeLightBlue
            m_lColorHeaderColorOne = RGB(0, 45, 150)
            m_lColorHeaderColorTwo = RGB(89, 135, 214)
            m_lColorHeaderForeColor = RGB(172, 191, 227)
            m_lColorCollapseButtonColor = RGB(172, 191, 227)

            m_lColorFooterColorOne = RGB(255, 255, 255)
            m_lColorFooterColorTwo = RGB(201, 211, 243)
            m_lColorFooterForeColor = RGB(215, 230, 251)

            m_lColorContainerColorOne = RGB(246, 247, 248)
            m_lColorContainerColorTwo = RGB(246, 247, 248)
            m_lColorContainerColorBorder = RGB(124, 124, 148)

        Case xThemeMediaPlayer2
            m_lColorHeaderColorOne = RGB(255, 255, 255)
            m_lColorHeaderColorTwo = RGB(201, 211, 243)
            m_lColorHeaderForeColor = RGB(0, 41, 99)
            m_lColorCollapseButtonColor = RGB(172, 191, 227)

            m_lColorFooterColorOne = RGB(255, 255, 255)
            m_lColorFooterColorTwo = RGB(184, 205, 236)
            m_lColorFooterForeColor = RGB(0, 41, 99)

            m_lColorContainerColorOne = RGB(255, 255, 255)
            m_lColorContainerColorTwo = RGB(201, 211, 243)
            m_lColorContainerColorBorder = RGB(184, 205, 236)

        Case xThemeMetallic
            m_lColorHeaderColorOne = RGB(219, 220, 232)
            m_lColorHeaderColorTwo = RGB(149, 147, 177)
            m_lColorHeaderForeColor = RGB(119, 118, 151)
            m_lColorCollapseButtonColor = RGB(106, 90, 205)

            m_lColorFooterColorOne = RGB(149, 147, 177)
            m_lColorFooterColorTwo = RGB(207, 223, 239)
            m_lColorFooterForeColor = RGB(215, 230, 251)

            m_lColorContainerColorOne = RGB(232, 232, 232)
            m_lColorContainerColorTwo = RGB(232, 232, 232)
            m_lColorContainerColorBorder = RGB(119, 118, 151)

        Case xThemeOrange
            m_lColorHeaderColorOne = RGB(255, 122, 0)
            m_lColorHeaderColorTwo = RGB(130, 0, 0)
            m_lColorHeaderForeColor = RGB(255, 222, 173)
            m_lColorCollapseButtonColor = RGB(246, 172, 84)

            m_lColorFooterColorOne = RGB(180, 99, 1)
            m_lColorFooterColorTwo = RGB(130, 0, 0)
            m_lColorFooterForeColor = RGB(215, 230, 251)

            m_lColorContainerColorOne = RGB(255, 222, 173)
            m_lColorContainerColorTwo = RGB(224, 180, 97)
            m_lColorContainerColorBorder = RGB(139, 0, 0)

        Case xThemeTurquoise
            m_lColorHeaderColorOne = RGB(72, 209, 204)
            m_lColorHeaderColorTwo = RGB(43, 103, 109)
            m_lColorHeaderForeColor = RGB(233, 250, 248)
            m_lColorCollapseButtonColor = RGB(193, 240, 234)

            m_lColorFooterColorOne = RGB(0, 139, 139)
            m_lColorFooterColorTwo = RGB(0, 128, 128)
            m_lColorFooterForeColor = RGB(215, 230, 251)

            m_lColorContainerColorOne = RGB(224, 255, 255)
            m_lColorContainerColorTwo = RGB(224, 255, 255)
            m_lColorContainerColorBorder = RGB(65, 131, 111)

        Case xThemeGray
            m_lColorHeaderColorOne = RGB(192, 192, 192)
            m_lColorHeaderColorTwo = RGB(51, 51, 51)
            m_lColorHeaderForeColor = RGB(235, 235, 235)
            m_lColorCollapseButtonColor = RGB(220, 220, 220)

            m_lColorFooter

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -