📄 costprice.cls
字号:
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
' 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_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
' ElseIf UCase(ctrInput.Name) = "DTMINPUT" Or UCase(ctrInput.Name) = "CURINPUT" Then
' If ctrInput.IsDropDown Then
'
' 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.GrdCol.Visible Then DrawTotalBox
If frmName.GrdCol.Visible Then DrawAllButton
End If
Else
mclsHook.CallWndProc Msg, wParam, lParam
End If
End Sub
'Private Sub mclsPicHook_WndProc(Msg As Long, wParam As Long, lParam As Long, Result As Long)
' If Msg = WM_PAINT Then
' mclsHook.CallWndProc Msg, wParam, lParam
' If My.blnRefresh Then
' If picInput.Visible Then
' DrawPicCtrButton
' End If
' End If
' Else
' End If
'End Sub
Private Sub DrawGridLine()
Dim intI As Integer
Dim lngRowheight As Long
Dim lngHdc As Long
My.blnRefresh = False
'写第三列上显示的文本
' For inti = frmname.grdCol.TopRow To frmname.grdCol.rows - 1
' WriteAString frmname.grdCol.hWnd, frmname.grdCol.ColPos(3) + 30, _
' frmname.grdCol.RowPos(inti) + 10, _
' frmname.grdCol.TextMatrix(inti, 5), 10
' WriteAString frmname.grdCol.hWnd, frmname.grdCol.ColPos(3) + frmname.grdCol.ColWidth(3) * 50 / 100 + 60, _
' frmname.grdCol.RowPos(inti) + 10, _
' frmname.grdCol.TextMatrix(inti, 6), 9
' WriteAString frmname.grdCol.hWnd, frmname.grdCol.ColPos(3) + frmname.grdCol.ColWidth(3) * 25 / 100 + 30, _
' frmname.grdCol.RowPos(inti) + frmname.grdCol.RowHeight(0) + 10, _
' frmname.grdCol.TextMatrix(inti, 9), 12
' Next inti
SeparateLineColor = fccolor.lngGridLineColor 'GRID列分隔线色
'画GRID网格线
With frmName.GrdCol
lngHdc = GetDC(.hWnd)
lngRowheight = .RowHeight(0)
For intI = 1 To 40
'画水平线
If lngRowheight * intI > .Height Then Exit For
' DrawALine lngHdc, 0, lngRowheight * intI - Screen.TwipsPerPixelY, _
' .width, lngRowheight * intI - Screen.TwipsPerPixelY, _
' GridClipRect.Left, GridClipRect.top, GridClipRect.Right, GridClipRect.Bottom, SeparateLineColor '画第三列上线条
If frmName.GrdCol.Row <> 0 And (intI = frmName.GrdCol.Row - frmName.GrdCol.TopRow + 1 Or intI = frmName.GrdCol.Row - frmName.GrdCol.TopRow + 2) Then
DrawBLine lngHdc, 0, lngRowheight * intI - Screen.TwipsPerPixelY, _
.width, lngRowheight * intI - Screen.TwipsPerPixelY, _
C2lng(RGB(0, 0, 255)) 'frmName.lblCaption.ForeColor
Else
DrawBLine lngHdc, 0, lngRowheight * intI - Screen.TwipsPerPixelY, _
.width, lngRowheight * intI - Screen.TwipsPerPixelY, _
SeparateLineColor
End If
' If lngrowheight * 2 * inti > .Height Then Exit For
' '横线
' DrawALine lngHdc, .ColPos(3), lngrowheight * (2 * inti), _
' .ColPos(3) + .ColWidth(3), lngrowheight * (2 * inti), _
' GridClipRect.Left, GridClipRect.Top, GridClipRect.Right, GridClipRect.Bottom
'竖线
' DrawALine lngHdc, .ColPos(3) + .ColWidth(3) * 50 / 100, lngrowheight * (2 * inti - 1), _
' .ColPos(3) + .ColWidth(3) * 50 / 100, lngrowheight * (2 * inti), _
' GridClipRect.Left, GridClipRect.Top, GridClipRect.Right, GridClipRect.Bottom
'箭头
' DrawArrow lngHdc, .ColPos(3) + .ColWidth(3) * 50 / 100 - 200, lngrowheight * (2 * inti - 1) + 30
Next intI
'画竖线
For intI = 1 To .Cols - 1
If .ColPos(intI) + .ColWidth(intI) >= .width - Screen.TwipsPerPixelX Or (Not .ColIsVisible(intI)) Then
Else
' If .RowHeight(0) * .Rows < .Height Then
' DrawALine lngHdc, .ColPos(inti) + .ColWidth(inti) - 15, 0, _
' .ColPos(inti) + .ColWidth(inti) - 15, .RowHeight(0) * .Rows, _
' GridClipRect.Left, GridClipRect.Top, GridClipRect.Right, GridClipRect.Bottom, RGB(128, 128, 128)
' Else
DrawALine lngHdc, .ColPos(intI) + .ColWidth(intI) - 15, 0, _
.ColPos(intI) + .ColWidth(intI) - 15, .Height, _
GridClipRect.Left, GridClipRect.top, GridClipRect.Right, GridClipRect.Bottom, SeparateLineColor
'End If
End If
Next intI
If frmName.chkPrint(1).Value = 0 Then
' .Refresh
Else
' frmName.PaintPicture Utility.GetFormResPicture(1024, 0), _
' frmName.lblCaption.Left + frmName.lblCaption.Width + 30, frmName.LblBack.top
DrawAIcon .hWnd, frmName.lblCaption.Left + frmName.lblCaption.width, .RowHeight(0), 1024
Utility.RemoveFormResPicture (1024)
End If
ReleaseDC .hWnd, lngHdc
End With
My.blnRefresh = True
End Sub
Public 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
Dim lngHdc As Long
Dim lngRowheight As Long
Dim blnRefreshBak As Boolean
blnRefreshBak = My.blnRefresh
My.blnRefresh = False
With frmName.GrdCol
lngRowheight = .RowHeight(0)
lngHdc = GetDC(.hWnd)
If .RowIsVisible(.Rows - 1) = False Then Exit Sub
intLeft = 1
If intLeft = 0 Then intLeft = 1
For i = intLeft To .Cols - 1
If ColProperty(i).blnReadOnly Then
If .ColIsVisible(i) And .ColWidth(i) <> 0 Then
x1 = .ColPos(i)
x2 = .ColPos(i) + .ColWidth(i) - 2 * Screen.TwipsPerPixelX
If .RowPos(.Rows - 1) + .RowHeight(.Rows - 1) < .Height Then
y1 = .RowPos(.Rows - 1) + lngRowheight
y2 = y1 - 2 * Screen.TwipsPerPixelY
For intR = 1 To 30
y2 = y2 + lngRowheight '.RowPos(.Rows - 1) + lngRowHeight * intR
If y2 > .Height Then
y2 = y2 - lngRowheight
Exit For
End If
Next intR
DrawABox lngHdc, x1, y1, x2, y2, RGB(192, 192, 192), RGB(192, 192, 192)
End If
End If
End If
Next i
ReleaseDC .hWnd, lngHdc
End With
If frmName.chkPrint(1).Value = 1 Then
DrawAIcon frmName.GrdCol.hWnd, frmName.lblCaption.Left + frmName.lblCaption.width, lngRowheight, 1024
Utility.RemoveFormResPicture (1024)
End If
My.blnRefresh = blnRefreshBak
End Sub
'Private Sub DrawTotalBox()
' Dim intI As Integer
' '画阴影
' DrawABox frmName.hwnd, frmName.LblBack.Left + frmName.LblBack.Width, _
' frmName.LblBack.top + 3 * Screen.TwipsPerPixelY, _
' frmName.LblBack.Left + frmName.LblBack.Width + 2 * Screen.TwipsPerPixelX, _
' frmName.LblBack.top + frmName.LblBack.Height + 3 * Screen.TwipsPerPixelY, _
' RGB(128, 128, 128), True
' DrawABox frmName.hwnd, frmName.LblBack.Left + 3 * Screen.TwipsPerPixelX, _
' frmName.LblBack.top + frmName.LblBack.Height + 0 * Screen.TwipsPerPixelY, _
' frmName.LblBack.Left + frmName.LblBack.Width + 0 * Screen.TwipsPerPixelX, _
' frmName.LblBack.top + frmName.LblBack.Height + 3 * Screen.TwipsPerPixelY, _
' RGB(128, 128, 128), True
'
' '画标题下的横线
' DrawALine frmName.hwnd, frmName.lblCaption.Left, frmName.lblCaption.top + frmName.lblCaption.Height + 2 * Screen.TwipsPerPixelY, _
' frmName.lblCaption.Left + frmName.lblCaption.Width, frmName.lblCaption.top + frmName.lblCaption.Height + 2 * Screen.TwipsPerPixelY, _
' FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom, RGB(0, 0, 0)
' '画合计栏上的竖线
' For intI = 1 To frmName.grdCol.Cols - 1
' If frmName.grdCol.ColPos(intI) + frmName.grdCol.ColWidth(intI) >= frmName.grdCol.Width - Screen.TwipsPerPixelX Or (Not frmName.grdCol.ColIsVisible(intI)) Then
' Else
' DrawALine frmName.hwnd, frmName.grdCol.Left + frmName.grdCol.ColPos(intI) + frmName.grdCol.ColWidth(intI) - Screen.TwipsPerPixelX, frmName.grdCol.top + frmName.grdCol.Height, _
' frmName.grdCol.Left + frmName.grdCol.ColPos(intI) + frmName.grdCol.ColWidth(intI) - Screen.TwipsPerPixelX, frmName.grdCol.top + frmName.grdCol.Height + frmName.grdCol.RowHeight(0), _
' FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom
' End If
' Next intI
' '画GRID下的表格
' DrawABox frmName.hwnd, frmName.grdCol.Left - Screen.TwipsPerPixelX, frmName.grdCol.top - 1 * Screen.TwipsPerPixelY, _
' frmName.grdCol.Left + frmName.grdCol.Width - 0 * Screen.TwipsPerPixelX, frmName.lblmemo(0).top - 3 * Screen.TwipsPerPixelY
' DrawALine frmName.hwnd, frmName.grdCol.Left, frmName.grdCol.top + frmName.grdCol.Height + 0, _
' frmName.grdCol.Left + frmName.grdCol.Width, frmName.grdCol.top + frmName.grdCol.Height + 0, _
' FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom
' DrawALine frmName.hwnd, frmName.grdCol.Left, frmName.grdCol.top + frmName.grdCol.Height + frmName.grdCol.RowHeight(0) + 0, _
' frmName.grdCol.Left + frmName.grdCol.Width, frmName.grdCol.top + frmName.grdCol.Height + frmName.grdCol.RowHeight(0) + 0, _
' FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom
' DrawALine frmName.hwnd, frmName.lblNote(0).Left + frmName.lblNote(0).Width + 30, frmName.grdCol.top + frmName.grdCol.Height, _
' frmName.lblNote(0).Left + frmName.lblNote(0).Width + 30, frmName.lblmemo(0).top - 50, _
' FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom
' '画备注框
'
' DrawALine frmName.hwnd, frmName.lblmemo(0).Left - Screen.TwipsPerPixelX, _
' frmName.lblmemo(0).top - Screen.TwipsPerPixelY, _
' frmName.lblmemo(frmName.lblmemo.Count - 3).Left + frmName.lblmemo(frmName.lblmemo.Count - 3).Width + Screen.TwipsPerPixelX, _
' frmName.lblmemo(0).top - Screen.TwipsPerPixelY, _
' FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom, 0
' DrawALine frmName.hwnd, frmName.lblmemo(0).Left - Screen.TwipsPerPixelX, _
' frmName.lblmemo(1).top + frmName.lblmemo(1).Height, _
' frmName.lblmemo(frmName.lblmemo.Count - 3).Left + frmName.lblmemo(frmName.lblmemo.Count - 3).Width + Screen.TwipsPerPixelX, _
' frmName.lblmemo(1).top + frmName.lblmemo(1).Height, _
' FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom, 0
' intI = 0
' DrawALine frmName.hwnd, frmName.lblmemo(intI).Left - Screen.TwipsPerPixelX, _
' frmName.lblmemo(1).top - Screen.TwipsPerPixelY, _
' frmName.lblmemo(intI).Left - Screen.TwipsPerPixelX, _
' frmName.lblmemo(1).top + frmName.lblmemo(1).Height + 0, _
' FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom, 0
' For intI = 0 To frmName.lblmemo.Count - 3
' If frmName.grdCol.ColPos(intI) + frmName.grdCol.ColWidth(intI) >= frmName.grdCol.Width - Screen.TwipsPerPixelX Or (Not frmName.grdCol.ColIsVisible(intI)) Then Exit For
' If frmName.lblmemo(intI).Visible = False Then Exit For
' DrawALine frmName.hwnd, frmName.lblmemo(intI).Left + frmName.lblmemo(intI).Width + 1 * Screen.TwipsPerPixelX, _
' frmName.lblmemo(1).top - Screen.TwipsPerPixelY, _
' frmName.lblmemo(intI).Left + frmName.lblmemo(intI).Width + 1 * Screen.TwipsPerPixelX, _
' frmName.lblmemo(1).top + frmName.lblmemo(1).Height + 1 * Screen.TwipsPerPixelY, _
' FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom, 0
' Next intI
'
' '画快捷键的下画线
'' For inti = 0 To 4 Step 2
' intI = 4
' DrawALine frmName.hwnd, frmName.lblHead(intI).Left + frmName.lblHead(intI).Width - 2 * frmName.FontSize * 10, frmName.lblHead(intI).top + frmName.lblHead(intI).Height + 0, _
' frmName.lblHead(intI).Left + frmName.lblHead(intI).Width - 1 * frmName.FontSize * 10, frmName.lblHead(intI).top + frmName.lblHead(intI).Height + 0, _
' FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom, RGB(0, 0, 0)
'' Next inti
' intI = 0
' DrawALine frmName.hwnd, frmName.lblmemo(intI).Left + frmName.lblmemo(intI).Width - 2 * frmName.FontSize * 10, frmName.lblmemo(intI).top + frmName.lblmemo(intI).Height + 0, _
' frmName.lblmemo(intI).Left + frmName.lblmemo(intI).Width - 1 * frmName.FontSize * 10, frmName.lblmemo(intI).top + frmName.lblmemo(intI).Height + 0, _
' FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom, RGB(0, 0, 0)
'End Sub
Public Sub DrawTotalBox(Optional ByVal blnErase As Boolean = False)
' Dim intI As Integer
' Dim lngColor As Long
' 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, _
' .LblB
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -