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

📄 clsstriprigout.cls

📁 金算盘软件代码
💻 CLS
📖 第 1 页 / 共 5 页
字号:
    Erase arrItemProperty
    Erase arr1ItemProperty
    Set ColBill = Nothing  '单据内容集合(不包括ActivityID和DetailID)
    Set ctrInput = Nothing
    Set ctrPicInput = Nothing
    Set frmName = Nothing
End Sub
Public Sub Form_key_Down(ByVal KeyCode As Long)
    Dim bCancel As Long
    HookHe_OnMessage frmName.hWnd, WM_KEYDOWN, KeyCode, 0, bCancel
End Sub

Private Sub HookHe_OnMessage(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long, bCancel As Long)
    On Error Resume Next
    If Msg = WM_CHAR Or Msg = WM_KEYDOWN Or Msg = WM_KEYUP Then
        If m_bBusy Then
            bCancel = 1
            Exit Sub
        End If
        If blnNotRespondKeyPress Then
            Exit Sub
        End If
    End If
    If Msg = WM_KEYDOWN Then
        If Not (frmName.refInput.ReferVisible Or frmName.refInput1.ReferVisible Or frmName.dtmInput.IsDropDown = 1) Then
            If wParam = 38 Or wParam = 40 Then     'TAB键处理程序
                mblnReadOnly = (Not My.blnMayChange) Or frmName.chkPrint(1).Value = 1 '权限控制
                If mblnReadOnly Then
                    If My.bytRegion = FNote Then
                        If wParam = 38 Then
                            If frmName.GrdCol.Row = 1 Then
                                mblnKeyDown = True
                            End If
                        ElseIf wParam = 40 Then
                            If frmName.GrdCol.Row = frmName.GrdCol.Rows - 1 Then
                                mblnKeyDown = True
                            End If
                        End If
                    Else
                        mblnKeyDown = True
                    End If
                Else
                    mblnKeyDown = True
                End If
            ElseIf wParam = 37 Then ' left
                If My.bytRegion = FField Or My.bytRegion = FHead Or My.bytRegion = FGrid Or My.bytRegion = FGrid1 Or My.bytRegion = FcmdFooter Or My.bytRegion = FFooter Then
                    If Not ctrInput Is Nothing Then
                        If ctrInput.Name = "picInput" Then
                            If NewQ.SelStart = 0 Then
                                mblnKeyDown = True
                            End If
                        Else
                            If ctrInput.SelStart = 0 Then
                                mblnKeyDown = True
                            End If
                        End If
                    Else
                        mblnKeyDown = True
                    End If
                Else
                    mblnKeyDown = True
                End If
            ElseIf wParam = 39 Then 'right
                If My.bytRegion = FField Or My.bytRegion = FHead Or My.bytRegion = FGrid Or My.bytRegion = FGrid1 Or My.bytRegion = FcmdFooter Or My.bytRegion = FFooter Then
                    If Not ctrInput Is Nothing Then
                        If ctrInput.Name = "picInput" Then
                            If NewQ.SelStart = Len(NewQ.Text) Then
                                mblnKeyDown = True
                            End If
                        Else
                            If ctrInput.SelStart = Len(ctrInput.Text) Then
                                mblnKeyDown = True
                            End If
                        End If
                    Else
                        mblnKeyDown = True
                    End If
                Else
                    mblnKeyDown = True
                End If
            ElseIf wParam = 27 Then 'ESCAPE
                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键处理程序
            m_bBusy = True
            TabOrder (wParam)
            m_bBusy = False
        ElseIf wParam = 27 Then 'ESCAPE
            Reload
        End If
    End If
End Sub

Private Sub mclsSubClass1_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
        mclsSubClass1.CallWndProc Msg, wParam, lParam
        '确保第0列不被拖出
        If frmName.grdCol1.ColWidth(0) > 0 Then frmName.grdCol1.ColWidth(0) = 0
        For i = 1 To frmName.grdCol1.Cols - 1
            If ColProperty(i).blnUsable = False Then
                If frmName.grdCol1.ColWidth(i) <> 0 Then
                    frmName.grdCol1.ColWidth(i) = 0
                End If
            Else
                If ColProperty(i).lngCtrType = TRefer Or ColProperty(i).lngCtrType = TRecList Or ColProperty(i).lngCtrType = tdate Then
                    If frmName.grdCol1.ColWidth(i) < 500 Then frmName.grdCol1.ColWidth(i) = 500
                Else
                    If frmName.grdCol1.ColWidth(i) < 100 Then frmName.grdCol1.ColWidth(i) = 100
                End If
            End If
        Next i
        If blnColDrag Then
            blnColDrag = False
            With frmName.GrdCol
                My.blnRefresh = False
                ReSetColWidth frmName.grdCol1, frmName.GrdCol
                If My.bytRegion = FGrid1 Or My.bytRegion = FGrid Then
                    If My.bytIndex <> .col Then
                        .col = My.bytIndex
                    End If
                    If My.bytRegion = FGrid1 Then
                        GrdInputButtonLocal1 1, My.lngOldCol
                    Else
                        GrdInputButtonLocal frmName.GrdCol.Row, frmName.GrdCol.col
                    End If
                End If
                TotalRowAdjust
                My.blnRefresh = True
                'frmname.Refresh
            End With
        End If
        Exit Sub
    End If
    
    If Msg = WM_LBUTTONDOWN Then        '鼠标左键按下
        With frmName.grdCol1
            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
        mclsSubClass1.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
                mclsSubClass1.CallWndProc Msg, wParam, lParam
                If frmName.grdCol1.Visible Then
                    DrawGridLine
                    DrawReadOnlyCol
                End If
                m_pBusy = False
            End If
        End If
    Else
        mclsSubClass1.CallWndProc Msg, wParam, lParam
    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 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
                End If
            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
        If blnColDrag Then
            blnColDrag = False
            With frmName.GrdCol
                My.blnRefresh = False
                ReSetColWidth frmName.GrdCol, frmName.grdCol1
                
                If My.bytRegion = FGrid Or My.bytRegion = FGrid1 Then
                    If My.bytIndex <> .col Then
                        .col = My.bytIndex
                    End If
                    If My.bytRegion = FGrid Then
                        GrdInputButtonLocal .Row, .col
                    Else
                        GrdInputButtonLocal1 frmName.grdCol1.Row, frmName.grdCol1.col
                    End If
                End If
                TotalRowAdjust
                My.blnRefresh = True
                'frmname.Refresh
            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
                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 lngT 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网格线
        '画竖线
        lngT = 0
        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) - Scre

⌨️ 快捷键说明

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