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

📄 clsstartperiod.cls

📁 金算盘软件代码
💻 CLS
📖 第 1 页 / 共 5 页
字号:
                Else
                    mblnKeyDown = True
                End If
            ElseIf wParam = 27 Then
                mblnKeyDown = True
            End If
        End If
        If wParam = 9 Or wParam = 13 Then
            mblnKeyDown = True
        End If
    End If
    
    If Msg = WM_KEYUP Then
        If mblnKeyDown = False Then Exit Sub
        mblnKeyDown = False
        If wParam = 13 Then
            If GetKeyState(17) < 0 Then
                Exit Sub
            End If
        End If
        If wParam = 37 Or wParam = 38 Or wParam = 39 Or wParam = 40 Or wParam = 9 Or wParam = 13 Then    'TAB键处理程序
            If Not m_bBusy Then
                m_bBusy = True
                ShiftDown = GetKeyState(16)  'Shift 状态
                TabOrder (wParam)
                m_bBusy = False
            End If
        ElseIf wParam = 27 Then
            Reload
        End If
    End If
End Sub

Private Sub mclsSubClass_WndProc(Msg As Long, wParam As Long, lParam As Long, Result As Long)
    Dim lngX As Long, lngY As Long
    Dim sinX As Single, sinY As Single
    Dim lngCnt As Long
    Dim i As Integer, mOldRow As Integer, mOldCol As Integer
    Dim intRow As Integer
    Static blnColDrag As Boolean

    lngX = (lParam Mod (2 ^ 16)) * Screen.TwipsPerPixelX
    lngY = (lParam \ (2 ^ 16)) * Screen.TwipsPerPixelY
    sinX = lngX
    sinY = lngY
    If Msg = WM_LBUTTONUP Then
        mclsSubClass.CallWndProc Msg, wParam, lParam
        '确保第0列不被拖出
        If blnColDrag Then
            If frmName.GrdCol.ColWidth(0) > 0 Then frmName.GrdCol.ColWidth(0) = 0
            For i = 1 To frmName.GrdCol.Cols - 1
                If ColProperty(i).blnUsable = False Then
                    If frmName.GrdCol.ColWidth(i) <> 0 Then frmName.GrdCol.ColWidth(i) = 0
                Else
                    If ColProperty(i).lngCtrType = TRefer Or ColProperty(i).lngCtrType = TRecList Or ColProperty(i).lngCtrType = tdate Then
                        If frmName.GrdCol.ColWidth(i) < 500 Then frmName.GrdCol.ColWidth(i) = 500
                    Else
                        If frmName.GrdCol.ColWidth(i) < 100 Then frmName.GrdCol.ColWidth(i) = 100
                    End If
                End If
            Next i
            blnColDrag = False
            With frmName.GrdCol
                My.blnRefresh = False
                If My.bytRegion = FGrid Or My.bytRegion = FPicture Then
                    If My.bytIndex <> .col Then
                        .col = My.bytIndex
                    End If
                    If My.lngOldRow <> .Row Then
                        .Row = My.lngOldRow
                    End If
                     GrdInputButtonLocal .Row, .col
                End If
                TotalRowAdjust
                My.blnRefresh = True
            End With
        End If
        Exit Sub
    End If
    
    If Msg = WM_LBUTTONDOWN Then        '鼠标左键按下
        With frmName.GrdCol
            If .MouseRow < .FixedRows Then    '点中固定行
                '判断鼠标是否点中列线以便拖动
                i = .MouseCol
                If lngX >= .ColPos(i) + .ColWidth(i) - 50 Or lngX <= .ColPos(i) + 50 Then
                    blnColDrag = True
                End If
            End If
        End With
        mclsSubClass.CallWndProc Msg, wParam, lParam
        Exit Sub
    End If
    
    If Msg = WM_PAINT Then
    '取Paint事件矩形区域
        If My.blnRefresh Then
            '取Paint事件矩形区域
            If Not m_pBusy Then
                m_pBusy = True
                GetUpdateRect frmName.GrdCol.hwnd, GridClipRect, False
                mclsSubClass.CallWndProc Msg, wParam, lParam
                If frmName.GrdCol.Visible Then
                    DrawGridLine
                    DrawReadOnlyCol
    '               Debug.Print Time
                End If
                m_pBusy = False
            End If
        End If
    Else
        mclsSubClass.CallWndProc Msg, wParam, lParam
    End If
End Sub
Private Sub mclsHook_WndProc(Msg As Long, wParam As Long, lParam As Long, Result As Long)
    Dim MinMax As MINMAXINFO

    If Msg = WM_GETMINMAXINFO Then
        CopyMemory MinMax, ByVal lParam, Len(MinMax)
        
        MinMax.ptMinTrackSize.x = lngDefaultWidth \ Screen.TwipsPerPixelX
        MinMax.ptMinTrackSize.y = lngDefaultHeight \ Screen.TwipsPerPixelY
        MinMax.ptMaxTrackSize.x = 1800
        MinMax.ptMaxTrackSize.y = 1600
        
        CopyMemory ByVal lParam, MinMax, Len(MinMax)
        Result = 0
        Exit Sub
    End If
        

    If Msg = WM_PAINT Then
        If My.blnRefresh Then
            '取Paint事件矩形区域
            GetUpdateRect frmName.hwnd, FormClipRect, False
            mclsHook.CallWndProc Msg, wParam, lParam
            If frmName.lblHead(5).Visible Then DrawTotalBox
        End If
    Else
        mclsHook.CallWndProc Msg, wParam, lParam
    End If
End Sub

Private Sub DrawGridLine()
    
    Dim intI As Integer
    Dim hdc As Long
    Dim lngL As Long
    Dim lngLeft As Long
    Dim lngRight As Long
    Dim lngTop As Long
    Dim lngButton As Long
    Dim lngWidth As Long
    Dim lngHeight As Long
    
    My.blnRefresh = False
    With frmName.GrdCol
        hdc = GetDC(.hwnd)
        
                
        '画GRID网格线
        '画竖线
        lngWidth = .width
        lngHeight = .Height
        intI = 1
        lngLeft = .ColPos(intI) + .ColWidth(intI) - Screen.TwipsPerPixelX
        DrawALine hdc, lngLeft, 0, lngLeft, lngHeight, GridClipRect.Left, GridClipRect.top, GridClipRect.Right, GridClipRect.Bottom, SeparateLineColor
        For intI = .LeftCol To .Cols - 1
            lngLeft = .ColPos(intI) + .ColWidth(intI) - Screen.TwipsPerPixelX
            If lngLeft >= lngWidth Then
                Exit For
'            ElseIf .ColWidth(intI) = 0 Or (Not .ColIsVisible(intI)) Then
            Else
                DrawALine hdc, lngLeft, 0, _
                        lngLeft, lngHeight, _
                        GridClipRect.Left, GridClipRect.top, GridClipRect.Right, GridClipRect.Bottom, SeparateLineColor
            End If
        Next intI
        '画按纽
        If My.bytRegion = FGrid And False Then
            For intI = .LeftCol To .Cols - 1
                If (Not ColProperty(intI).blnReadOnly) And (ColProperty(intI).lngCtrType = TRefer Or ColProperty(intI).lngCtrType = tdate) And .ColIsVisible(intI) And .ColWidth(intI) <> 0 And .ColPos(intI) + .ColWidth(intI) < .width Then
                    DrawAButton hdc, .ColPos(intI) + .ColWidth(intI) - intButtonWidth - 2 * Screen.TwipsPerPixelX, _
                    .RowPos(.Row) + 1 * Screen.TwipsPerPixelY, intButtonWidth, .RowHeight(0) - 2 * Screen.TwipsPerPixelY, 0, _
                    GridClipRect.Left, GridClipRect.top, GridClipRect.Right, GridClipRect.Bottom
                End If
            Next intI
        End If
        lngHeight = .RowHeight(0)
        For intI = 1 To 40
            '画水平线
            If .RowHeight(0) * intI > .Height Then Exit For
                If .Row > 0 And (intI = .Row - .TopRow + 1 Or intI = .Row + 1 - .TopRow + 1) Then
                    DrawBLine hdc, 0, lngHeight * intI - Screen.TwipsPerPixelY, _
                           lngWidth, lngHeight * intI - Screen.TwipsPerPixelY, _
                             CLng(RGB(0, 0, 255))
                Else
                    DrawBLine hdc, 0, lngHeight * intI - Screen.TwipsPerPixelY, _
                           lngWidth, lngHeight * intI - Screen.TwipsPerPixelY, _
                            SeparateLineColor
                End If
        Next intI
    End With
    '画作废图片
    If frmName.chkPrint(1).Value = 1 Then
        With frmName.GrdCol
            DrawAIcon .hwnd, .Left + (.width - 140 * Screen.TwipsPerPixelX) \ 2, .RowHeight(0) + (.Height - .RowHeight(0) - 70 * Screen.TwipsPerPixelY) \ 2, 1024
        End With
    End If
    ReleaseDC frmName.GrdCol.hwnd, hdc
    My.blnRefresh = True
End Sub
Private Sub DrawReadOnlyCol()
    Dim intLeft As Integer
    Dim i As Integer
    Dim intR As Integer
    Dim x1 As Long, x2 As Long, y1 As Long, y2 As Long
    With frmName.GrdCol
        If .RowIsVisible(.Rows - 1) = False Then GoTo EndDraw
        intLeft = 1
        If intLeft = 0 Then intLeft = 1
        For i = intLeft To .Cols - 1
            If ColProperty(i).blnReadOnly And .ColIsVisible(i) And .ColWidth(i) <> 0 Then
                If .RowPos(.Rows - 1) + .RowHeight(.Rows - 1) < .Height Then
                    For intR = 1 To 30
                        x1 = .ColPos(i)
                        y1 = .RowPos(.Rows - 1) + .RowHeight(0) * intR
                        If y1 > .Height Then Exit For
                        x2 = .ColPos(i) + .ColWidth(i) - 2 * Screen.TwipsPerPixelX
                        y2 = y1 + .RowHeight(0) - 2 * Screen.TwipsPerPixelY
                        DrawABox .hwnd, x1, y1, x2, y2, _
                        RGB(192, 192, 192), RGB(192, 192, 192)
                    Next intR
                End If
            End If
        Next i
    End With
EndDraw:
    If frmName.chkPrint(1).Value = 1 Then
        With frmName.GrdCol
            DrawAIcon .hwnd, .Left + (.width - 140 * Screen.TwipsPerPixelX) \ 2, .RowHeight(0) + (.Height - .RowHeight(0) - 70 * Screen.TwipsPerPixelY) \ 2, 1024
        End With
    End If
End Sub
Private Sub DrawShadow(Optional ByVal blnErase As Boolean = False)
    Dim lngColor As Long
    Dim intI As Integer
    With frmName
    
    '画阴影
    If blnErase = True Then
        lngColor = RGB(192, 192, 192)
    Else
        lngColor = RGB(128, 128, 128)
    End If
    DrawABox .hwnd, .LblBack.Left + .LblBack.width, _
                           .LblBack.top + 3 * Screen.TwipsPerPixelY, _
                           .LblBack.Left + .LblBack.width + 2 * Screen.TwipsPerPixelX, _
                           .LblBack.top + .LblBack.Height + 3 * Screen.TwipsPerPixelY, _
                           lngColor, True
    DrawABox .hwnd, .LblBack.Left + 3 * Screen.TwipsPerPixelX, _
                           .LblBack.top + .LblBack.Height + 0 * Screen.TwipsPerPixelY, _
                           .LblBack.Left + .LblBack.width + 0 * Screen.TwipsPerPixelX, _
                           .LblBack.top + .LblBack.Height + 3 * Screen.TwipsPerPixelY, _
                           lngColor, True
    
    '画快捷键的下画线
    If blnErase = True Then
        lngColor = RGB(192, 192, 192)
    Else
        lngColor = RGB(0, 0, 0)
    End If
    For intI = 0 To 4 Step 2
            DrawBLine .hwnd, .lblHead(intI).Left + .lblHead(intI).width - 2 * .FontSize * 10, .lblHead(intI).top + .lblHead(intI).Height + 0, _
                .lblHead(intI).Left + .lblHead(intI).width - 1 * .FontSize * 10, .lblHead(intI).top + .lblHead(intI).Height + 0, lngColor
    Next intI
   End With
End Sub

Public Sub DrawTotalBox(Optional ByVal blnErase As Boolean = False)
    Dim intI As Integer
    Dim lngColor As Long
    Dim hdc As Long
    Dim lngL As Long
    Dim lngLeft As Long
    Dim lngRight As Long
    Dim lngTop As Long
    Dim lngButton As Long
    Dim lngWidth As Long
    With frmName
    hdc = GetDC(.hwnd)
    DrawAllButton hdc
    '画阴影
    If blnErase = True Then
        lngColor = RGB(192, 192, 192)
    Else
        lngColor = RGB(128, 128, 128)
    End If
    lngLeft = .LblBack.Left
    lngTop = .LblBack.top
    lngRight = lngLeft + .LblBack.width
    lngButton = lngTop + .LblBack.Height
    DrawABox hdc, lngRight, _
                  lngTop + 3 * Screen.TwipsPerPixelY, _
                  lngRight + 2 * Screen.TwipsPerPixelX, _
                  lngButton + 3 * Screen.TwipsPerPixelY, _
                  lngColor, True
    DrawABox hdc, lngLeft + 3 * Screen.TwipsPerPixelX, _
                  lngButton, _
                  lngRight, _
                  lngButton + 3 * Screen.TwipsPerPixelY, _
                           lngColor, True
    '画标题下的横线
    If blnErase = True Then
        lngColor = fccolor.lngBackColor
    Else
        lngColor = fccolor.lngCaptionForeColor
    End If
    lngLeft = .lblCaption.Left

⌨️ 快捷键说明

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