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

📄 adjustcost.cls

📁 金算盘软件代码
💻 CLS
📖 第 1 页 / 共 5 页
字号:
            .grdCol.Left + .grdCol.Width, .grdCol.top + .grdCol.Height + .grdCol.RowHeight(0) + 0, _
            FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom, lngColor
        DrawALine .hwnd, .lblNote(0).Left + .lblNote(0).Width + 2 * Screen.TwipsPerPixelX, .grdCol.top + .grdCol.Height + .grdCol.RowHeight(0), _
                    .lblNote(0).Left + .lblNote(0).Width + 2 * Screen.TwipsPerPixelX, .lblmemo(0).top - 2 * Screen.TwipsPerPixelY, _
                    FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom, lngColor
    End If
    '画备注框
    Dim lngX2 As Long
    If .lblmemo(2).Visible Then
        lngX2 = .lblmemo(3).Left + .lblmemo(3).Width + Screen.TwipsPerPixelX
    Else
        lngX2 = .lblmemo(1).Left + .lblmemo(1).Width + Screen.TwipsPerPixelX
    End If
    If blnErase = True Then
'        lngColor = RGB(255, 255, 255)
'        DrawABox .hwnd, .lblmemo(0).Left - Screen.TwipsPerPixelX, _
'                           .lblmemo(0).top - Screen.TwipsPerPixelY, _
'                           .lblmemo(4).Left - 2 * Screen.TwipsPerPixelX, _
'                           .lblmemo(0).top + .lblmemo(0).Height + 1 * Screen.TwipsPerPixelY, _
'                           lngColor
        For intI = 1 To .lblmemo.Count - 2
            If .grdCol.ColPos(intI) + .grdCol.ColWidth(intI) >= .grdCol.Width - Screen.TwipsPerPixelX Or (Not .grdCol.ColIsVisible(intI)) Then Exit For
            DrawBLine .hwnd, .lblmemo(intI).Left - Screen.TwipsPerPixelX, _
                                    .lblmemo(1).top - Screen.TwipsPerPixelY, _
                                    .lblmemo(intI).Left - 1 * Screen.TwipsPerPixelX, _
                                    .lblmemo(1).top + .lblmemo(1).Height + 1 * Screen.TwipsPerPixelY, lngColor
        Next intI
    Else
        lngColor = 0
        DrawABox .hwnd, .lblmemo(1).Left - Screen.TwipsPerPixelX, _
                           .lblmemo(1).top - Screen.TwipsPerPixelY, _
                           .lblmemo(2).Left - 2 * Screen.TwipsPerPixelX, _
                           .lblmemo(1).top + .lblmemo(1).Height + 0 * Screen.TwipsPerPixelY, _
                           lngColor
'        For intI = 1 To .lblmemo.Count - 2
'            If .grdCol.ColPos(intI) + .grdCol.ColWidth(intI) >= .grdCol.Width - Screen.TwipsPerPixelX Or (Not .grdCol.ColIsVisible(intI)) Then Exit For
'            If .lblmemo(intI).Visible = False Then Exit For
'            DrawBLine .hwnd, .lblmemo(intI).Left - Screen.TwipsPerPixelX, _
'                                    .lblmemo(1).top - Screen.TwipsPerPixelY, _
'                                    .lblmemo(intI).Left - 1 * Screen.TwipsPerPixelX, _
'                                    .lblmemo(1).top + .lblmemo(1).Height + 1 * Screen.TwipsPerPixelY, lngColor
'        Next intI
    End If

    '画快捷键的下画线
    If blnErase = True Then
        lngColor = RGB(192, 192, 192)
        For intI = 0 To 4 Step 4
            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
    Else
        lngColor = RGB(0, 0, 0)
        For intI = 0 To 4 Step 4
            If .lblHead(intI).Visible Then
                DrawALine .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, _
                    FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom, lngColor
            End If
        Next intI
    End If
    '画备注快捷键的下画线
    If blnErase = True Then
        lngColor = RGB(255, 255, 255)
    Else
        lngColor = RGB(0, 0, 0)
    End If
    intI = 0
    DrawBLine .hwnd, .lblmemo(0).Left + .lblmemo(0).Width - 2 * .FontSize * 10, .lblmemo(0).top + .lblmemo(0).Height - 60, _
        .lblmemo(0).Left + .lblmemo(0).Width - 1 * .FontSize * 10, .lblmemo(0).top + .lblmemo(intI).Height - 60, lngColor
    End With
End Sub

Private Sub DrawAllButton()
    Dim i As Integer
    Dim lngBackColor As Long
    
    lngBackColor = BillPublic.GetSysColor(COLOR_BTNFACE)
    With frmName
    '画FIELD区按纽
    For i = 1 To .lblField.Count - 1
        If .lblField(i).Visible And (Field(i).lngCtrType = TDate Or Field(i).lngCtrType = TRefer) Then
            DrawAButton .hwnd, .lblField(i).Left + .lblField(i).Width - intButtonWidth, _
                            .lblField(i).top, intButtonWidth, .lblField(i).Height, 0, lngBackColor, _
                            FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom
'           DrawAButton .hWnd, .lblField(i).Left + .lblField(i).Width - intButtonWidth, _
'                            .lblField(i).Top, intButtonWidth, .lblField(i).Height, 0
        End If
    Next i
    '画HEAD行按纽
    For i = 1 To .lblHead.Count - 1 Step 4
        If .lblHead(i).Visible Then
            DrawAButton .hwnd, .lblHead(i).Left + .lblHead(i).Width - intButtonWidth - 2 * Screen.TwipsPerPixelX, _
                    .lblHead(i).top + 1 * Screen.TwipsPerPixelY, intButtonWidth, .lblHead(i).Height - 2 * Screen.TwipsPerPixelY, 0, lngBackColor, _
                    FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom
        End If
    Next i
    '画Field0处所粘贴行输入按纽
    If .lblNote.Count >= 6 Then
        If .lblNote(3).Visible Then
            For i = 3 To .lblNote.Count - 1 Step 2
                DrawAButton .hwnd, .lblNote(i).Left + .lblNote(i).Width - intButtonWidth - 0 * Screen.TwipsPerPixelX, _
                    .lblNote(i).top + 0 * Screen.TwipsPerPixelY, intButtonWidth, .lblNote(i).Height - 0 * Screen.TwipsPerPixelY, 0, lngBackColor, _
                    FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom
            Next i
        End If
    End If
    
    '画备注行按纽
'    I = 3
'    If .lblmemo(I).Visible Then
'        DrawAButton .hWnd, .lblmemo(I).Left + .lblmemo(I).Width - intButtonWidth - 0 * Screen.TwipsPerPixelX, _
'                    .lblmemo(I).top - 1 * Screen.TwipsPerPixelY, intButtonWidth, .lblmemo(I).Height + 1 * Screen.TwipsPerPixelY, 0, , _
'                    FormClipRect.Left, FormClipRect.top, FormClipRect.Right, FormClipRect.Bottom
'    End If
    
    '画作废图片
    If .chkPrint(1).Value = 0 Then
    '        Me.PaintPicture LoadPicture(), lblField(0).Left, lblField(0).Top
    Else
        .PaintPicture Utility.GetFormResPicture(1024, 0), _
                .lblCaption.Left + .lblCaption.Width + 2 * Screen.TwipsPerPixelX, _
                .LblBack.top + 2 * Screen.TwipsPerPixelY
        Utility.RemoveFormResPicture (1024)
    End If
    End With
End Sub
Public Sub InvoiceWithBill(ByVal blnInvoiceExit As Boolean)
'开票标志改变后重新调整模板
    If blnInvoiceExit Then
        frmName.lblFieldCaption(13).Caption = Field(13).strFieldName
        frmName.lblFieldCaption(14).Caption = Field(14).strFieldName
        Field(13).blnVisible = True
        Field(14).blnVisible = True
    Else
        Field(13).blnVisible = False
        Field(14).blnVisible = False
        With frmName
            .lblField(13).Visible = False
            .lblFieldCaption(13).Visible = False
            .lblField(14).Visible = False
            .lblFieldCaption(14).Visible = False
        End With
    End If
    FieldButtonNew
End Sub
Private Sub GrdAndLabelInitial()
'列表及LABEL控件初始化
    Dim intI As Integer
    Dim i%
    '--------------------------
    '应付单只显示1--5列
    '--------------------------
    With frmName.grdCol
        .ColWidth(0) = 0
'       For inti = 5 To .cols - 1
'            .ColWidth(inti) = 0
'       Next inti
        For intI = 1 To .Cols - 1
            If ColProperty(intI).blnUsable Then
                .ColWidth(intI) = ColProperty(intI).lngColWidth
            Else
                .ColWidth(intI) = 0
            End If
            If ColProperty(intI).lngCtrType = tCurrency Then
                .ColAlignment(intI) = 7
                If frmName.lblTotal.Count > intI Then
                    frmName.lblTotal(intI).Alignment = 1
                End If
            Else
                .ColAlignment(intI) = 1
            End If
'            .Row = 0
'            .col = intI
'            .CellForeColor = frmName.lblFieldCaption(0).ForeColor
'            .CellBackColor = frmName.lblFieldCaption(0).BackColor
        Next intI
        ReadonlyColBackColor
        
    End With
    
    For intI = 0 To frmName.lblField.UBound
        If Field(intI).lngCtrType = tCurrency Then frmName.lblField(intI).Alignment = 1
        If intI = 0 Then
            frmName.lblField(intI).WordWrap = True
        Else
            frmName.lblField(intI).WordWrap = False
        End If
    Next intI
End Sub
Public Sub CurrRedWord()
    '对普通GRD内容中金额为负数的单元做红字显示处理
    Dim intI As Integer
    Dim i%
    Dim strText As String
    My.blnRefresh = False
    With frmName.grdCol
        If .Rows > .FixedRows Then
            For intI = .FixedCols To .Cols - 1
                If .ColWidth(intI) > 0 And ColProperty(intI).lngCtrType = tCurrency And ColProperty(intI).blnReadOnly = False Then
                    For i% = 1 To .Rows - 1
                        If C2Dbl(.TextMatrix(i%, intI)) < 0 Then
                            strText = .TextMatrix(i%, intI)
                            WriteGrd strText, i%, intI
                        End If
                    Next i%
                End If
            Next intI
        End If
    End With
    My.blnRefresh = True
End Sub
Public Sub ReadonlyColBackColor()
    '设只读列背静色
    Dim intI As Integer
    Dim i%
    Dim blnTmp As Boolean
    blnTmp = My.blnRefresh
    My.blnRefresh = False
    With frmName.grdCol
        If .Rows > .FixedRows Then
            For i% = 1 To .Cols - 1
                For intI = .FixedRows To .Rows - 1
                    If .ColWidth(i%) > 0 Then
                        .col = i%
                        .Row = intI
                        If ColProperty(i%).blnReadOnly Then
                                .CellBackColor = RGB(192, 192, 192)
                        Else
                            .CellBackColor = .BackColor
                        End If
                    End If
                Next intI
            Next i%
        End If
    End With
    My.blnRefresh = blnTmp
End Sub

Private Function lngGrdTop(ByVal bln4RowVisible As Boolean) As Long
    Dim lngTop As Long
    Dim i As Integer
    Dim j As Integer
    j = 1
    If bln4RowVisible Then
        lngTop = frmName.lblField(frmName.lblField.Count - 1).top + frmName.lblField(frmName.lblField.Count - 1).Height + SpaceTwRow * 2
        GoTo EndProc
    End If
    If Field(0).blnVisible Then
        lngTop = frmName.lblField(0).top + frmName.lblField(0).Height + SpaceTwRow * 2
        GoTo EndProc
    End If
    For i = frmName.lblField.Count - 1 To 1 Step -1
        If Field(i).blnVisible Then
            j = i
            Exit For
        End If
    Next i
    lngTop = frmName.lblField(j).top + frmName.lblField(j).Height + SpaceTwRow * 2
    
EndProc:
    lngGrdTop = lngTop
End Function
Private Sub RowAdjust(ByVal intRow As Integer)
 '调整一行的LABEL控件宽度(第0号LABEL控件宽度与第第2,3行LABEL控件一起调整)
    Dim lngRowUsableWidth As Long
    Dim lngSumWidth As Long
    Dim lngSumMaxWidth As Long
    Dim lngOneAdded As Long
    Dim intVisibleNO As Integer
    Dim i As Integer
    Dim intFirstIndex As Integer
    Dim intEndIndex As Integer
    intFirstIndex = 0
    '行总可用宽度
    Select Case intRow
        Case 1
            lngPosition(0, 2) = lngPosition(0, 3)
            lngPosition(1, 2) = lngPosition(1, 3)
            lngPosition(2, 2) = lngPosition(2, 3)
            Exit Sub
        Case 2, 3
            lngRowUsableWidth = ((frmName.ScaleWidth - (intCmd0Width + 5 * Screen.TwipsPerPixelX) _
                        - (5 + 3 + 3 + 2 * 5) * Screen.TwipsPerPixelX _
                        - lngPosition(0, 3) - 3 * Screen.TwipsPerPixelX) \ Screen.TwipsPerPixelX) * Screen.TwipsPerPixelX
        Case Else
            lngRowUsableWidth = ((frmName.ScaleWidth - (intCmd0Width + 5 * Screen.TwipsPerPixelX) _
                        - (5 + 3 + 3 + 2 * 5 + 1) * Screen.TwipsPerPixelX) \ Screen.TwipsPerPixelX) * Screen.TwipsPerPixelX
    End Select
    
    For i = 0 To frmName.lblField.UBound
        If Field(i).bytRow = intRow Then
            If intFirstIndex = 0 Then
               intFirstIndex = i    '行初始控件序号
            End If
            If Field(i).blnVisible Then
                intVisibleNO = intVisibleNO + 1    '行可视控件个数
            End If
            intEndIndex = i  '行结束控件序号
        End If
    Next i
         
        '行控件现宽度和
        lngSumWidth = 0
        lngSumMaxWidth = 0
        For i = intFirstIndex To intEndIndex
            If Field(i).blnVisible Then
                lngSumWidth = lngSumWidth + lngPosition(i, 2)
                lngSumMaxWidth = l

⌨️ 快捷键说明

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