📄 itemclass.cls
字号:
.col = lngCol
End If
If CLng(.CellForeColor) = CLng(RGB(255, 0, 0)) Then
strTmp = "-" & .TextMatrix(lngRow, lngCol)
Else
strTmp = .TextMatrix(lngRow, lngCol)
End If
If blnBackRowCol Then
If lngR <> lngRow Then
.Row = lngR
End If
If lngC <> lngCol Then
.col = lngC
End If
End If
strGrdCellReal = FilterString(strTmp, ",")
My.blnRefresh = blnRefreshBak
Else
strGrdCellReal = .TextMatrix(lngRow, lngCol)
End If
End With
End Function
Private Sub Class_Terminate()
Set mclsSubClass = Nothing
Set mclsHook = Nothing
Set HookHe = Nothing
Erase Field
' Erase PicLbl
Erase ColProperty
Erase lngPosition
Erase strColRow
Erase arrItemProperty
Erase RowPropertys
Erase Row2Position
Set ColBill = Nothing '单据内容集合(不包括ActivityID和DetailID)
Set DiscInfos = Nothing
Set ctrInput = Nothing
Set ctrPicInput = Nothing
Set frmName = Nothing
Set clsRecord = Nothing
Set clsRecordCustomer = Nothing
Set NewQ = Nothing
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)
Dim lngSelStart As Long
If Msg = WM_CHAR Or Msg = WM_KEYDOWN Or Msg = WM_KEYUP Then
If m_bBusy Then
bCancel = 1
GoTo EndProc
End If
If blnMenuVisible Then
GoTo EndProc
End If
End If
If Msg = WM_KEYDOWN Then
If wParam = 37 Or wParam = 39 Then
If Not ctrInput Is Nothing Then
If UCase(ctrInput.Name) = UCase("QuanInput") Then
lngSelStart = NewQ.SelStart
Else
lngSelStart = ctrInput.SelStart
End If
End If
End If
If wParam = 38 Or wParam = 9 Or wParam = 13 Then 'TAB键处理程序
If wParam = 13 And UCase(frmName.ActiveControl.Name) = "CMDBUTTON" Then
If frmName.ActiveControl.Index < 4 Then
blnKeyInForm = False
Else
blnKeyInForm = True
End If
Else
blnKeyInForm = True
End If
ElseIf wParam = 40 Then
blnKeyInForm = True
If Not ctrInput Is Nothing Then
If UCase(ctrInput.Name) = "RECLIST" Then
If ctrInput.ReferVisible Then
blnEscNoCancel = True
End If
End If
End If
ElseIf wParam = 37 Then
If Not ctrInput Is Nothing And My.bytRegion <> FcmdButton And My.bytRegion <> FCheck Then
If lngSelStart = 0 Then
blnKeyInForm = True
End If
Else
blnKeyInForm = True
End If
ElseIf wParam = 39 Then
If Not ctrInput Is Nothing And My.bytRegion <> FcmdButton And My.bytRegion <> FCheck Then
If lngSelStart = Len(TextOfCtrInput) Then
blnKeyInForm = True
End If
Else
blnKeyInForm = True
End If
ElseIf wParam = 27 Then 'ESCAPE
blnKeyInForm = True
If ctrInput Is Nothing Then
Else
If UCase(ctrInput.Name) = "REFINPUT" Or UCase(ctrInput.Name) = "DTMINPUT" Or UCase(ctrInput.Name) = "CURINPUT" Or UCase(ctrInput.Name) = "RECLIST" Then
If UCase(ctrInput.Name) = "REFINPUT" Then
If ctrInput.ReferVisible Then
blnEscNoCancel = True
GoTo EndProc
End If
ElseIf UCase(ctrInput.Name) = "DTMINPUT" Or UCase(ctrInput.Name) = "CURINPUT" Then
If ctrInput.IsDropDown Then
blnEscNoCancel = True
GoTo EndProc
End If
ElseIf UCase(ctrInput.Name) = "RECLIST" Then
If ctrInput.ReferVisible Then
ctrInput.PopRefer False
blnEscNoCancel = True
GoTo EndProc
End If
End If
End If
End If
blnEscNoCancel = False
ElseIf wParam = 16 Then 'Shift
blnKeyInForm = True
End If
End If
If Msg = WM_KEYUP Then
If Not blnKeyInForm Then
GoTo EndProc
End If
blnKeyInForm = False
If wParam = 37 Or wParam = 38 Or wParam = 39 Or wParam = 40 Or wParam = 9 Or wParam = 13 Then 'TAB键处理程序
If wParam = 13 Then
If GetKeyState(17) < 0 Then
GoTo EndProc
End If
End If
If Not m_bBusy Then
m_bBusy = True
TabOrder (wParam)
m_bBusy = False
End If
ElseIf wParam = 27 Then 'ESCAPE
If Not blnEscNoCancel Then
' Unload frmName
#If conWan = 1 Then
If My.bytRegion = FCheck Then
Unload frmName
Else
ChkSetFocus 0
End If
#Else
If My.bytRegion = FcmdButton And My.bytIndex = 0 Then
Unload frmName
Else
cmdButton_Click 0
End If
#End If
Else
blnEscNoCancel = False
End If
' Reload
' bCancel = 1
End If
End If
EndProc:
#If conWan = 1 Then
If Msg <> WM_MOUSEMOVE And Msg <> 280 Then
If My.bytRegion = FcmdButton Then
ChkSetFocus 0
End If
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 frmName.GrdCol.ColWidth(0) > 0 Then frmName.GrdCol.ColWidth(0) = 0
For i = 1 To frmName.GrdCol.Cols - 1
If ColProperty(i).blnUsable = False And frmName.GrdCol.ColWidth(i) <> 0 Then
frmName.GrdCol.ColWidth(i) = 0
End If
Next i
If blnColDrag Then
blnColDrag = False
With frmName.GrdCol
My.blnRefresh = False
For i = 1 To frmName.GrdCol.Cols - 1
If .ColWidth(i) < 490 And ColProperty(i).blnUsable Then
.ColWidth(i) = 490
End If
Next
If My.bytRegion = FGrid Or My.bytRegion = FPicture Then
If My.lngOldCol <> .col Then .col = My.lngOldCol
If My.lngOldRow <> .Row Then .Row = My.lngOldRow
GrdInputButtonLocal .Row, .col
End If
TotalRowAdjust
RefreshRect frmName.hwnd, frmName.GrdCol.Left, frmName.GrdCol.top + frmName.GrdCol.Height + 1 * Screen.TwipsPerPixelY, frmName.lblBack.Left + frmName.lblBack.width - 9 * Screen.TwipsPerPixelX, frmName.lblNote(1).top - 2 * Screen.TwipsPerPixelY
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
DrawReadOnlyCol
DrawGridLine
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_WINDOWPOSCHANGING Then
If ctrInput Is Nothing Then
Else
On Error Resume Next
If UCase(ctrInput.Name) = "REFINPUT" Or UCase(ctrInput.Name) = "DTMINPUT" Or UCase(ctrInput.Name) = "CURINPUT" Or UCase(ctrInput.Name) = "RECLIST" Then
If UCase(ctrInput.Name) = "REFINPUT" Or UCase(ctrInput.Name) = "RECLIST" Then
If ctrInput.ReferVisible Then
ctrInput.PopRefer False
Exit Sub
End If
End If
End If
End If
End If
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
If frmName.lblHead(5).Visible Then DrawAllButton
End If
Else
mclsHook.CallWndProc Msg, wParam, lParam
End If
End Sub
Private Sub DrawGridLine()
' Exit Sub
Dim intI As Integer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -