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

📄 billstart.cls

📁 金算盘软件代码
💻 CLS
📖 第 1 页 / 共 5 页
字号:
                                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
        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
Private Sub DrawAllButton()
    Dim i As Integer
        
    For i = 1 To frmName.lblField.Count - 1
        If frmName.lblField(i).Visible And (Field(i).lngCtrType = TDate Or Field(i).lngCtrType = TRefer) Then
            DrawAButton frmName.hWnd, frmName.lblField(i).Left + frmName.lblField(i).Width - intButtonWidth, _
                            frmName.lblField(i).Top, intButtonWidth, frmName.lblField(i).Height, 0, _
                            FormClipRect.Left, FormClipRect.Top, FormClipRect.Right, FormClipRect.Bottom
'           DrawAButton frmname.hWnd, frmname.lblField(i).Left + frmname.lblField(i).Width - intButtonWidth, _
'                            frmname.lblField(i).Top, intButtonWidth, frmname.lblField(i).Height, 0
        End If
    Next i
    For i = 1 To frmName.lblHead.Count - 1
        If (i \ 2) * 2 <> i Then
            If frmName.lblHead(i).Visible Then
                DrawAButton frmName.hWnd, frmName.lblHead(i).Left + frmName.lblHead(i).Width - intButtonWidth - 2 * Screen.TwipsPerPixelX, _
                            frmName.lblHead(i).Top + 1 * Screen.TwipsPerPixelY, intButtonWidth, frmName.lblHead(i).Height - 2 * Screen.TwipsPerPixelY, 0, _
                            FormClipRect.Left, FormClipRect.Top, FormClipRect.Right, FormClipRect.Bottom
            End If
        End If
    Next i
    If frmName.chkPrint(1).Value = 0 Then
'        Me.PaintPicture LoadPicture(), lblField(0).Left, lblField(0).Top
    Else
        frmName.PaintPicture LoadPicture("c:\account2\voidbill.bmp"), _
                frmName.lblCaption.Left + frmName.lblCaption.Width + 30, frmName.LblBack.Top
    End If

End Sub


Private Sub GrdAndLabelInitial()
'列表及LABEL控件初始化
    Dim inti As Integer
    '--------------------------
    '应付单只显示1--5列
    '--------------------------
    frmName.grdCol.ColWidth(0) = 0
'    For inti = 5 To frmname.grdCol.cols - 1
'        frmname.grdCol.ColWidth(inti) = 0
'    Next inti
    For inti = 1 To frmName.grdCol.Cols - 1
        
        If ColProperty(inti).blnUsable Then
            frmName.grdCol.ColWidth(inti) = ColProperty(inti).lngColWidth
        Else
            frmName.grdCol.ColWidth(inti) = 0
        End If
        If ColProperty(inti).lngCtrType = TCurrency Then
            frmName.grdCol.ColAlignment(inti) = 7
            If frmName.lblTotal.Count > inti Then
                frmName.lblTotal(inti).Alignment = 1
            End If
        End If
    Next inti
    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
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.lblFieldCaption(frmName.lblField.Count - 1).Top + SpaceTwRow
        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 = lngSumMaxWidth + lngPosition(i, 3)
            End If
        Next i
        
        lngRowUsableWidth = lngRowUsableWidth - (intVisibleNO - 1) * SPACETWIPS
        
        '可增加宽度和
        lngRowUsableWidth = lngRowUsableWidth - lngSumWidth
        For i = intFirstIndex To intEndIndex
            If lngRowUsableWidth <= 0 Or lngSumMaxWidth = 0 Then
                Exit For
            End If
            If Field(i).blnVisible Then
                lngOneAdded = (CLng(lngRowUsableWidth * lngPosition(i, 3) / lngSumMaxWidth) \ Screen.TwipsPerPixelX) * _
                             Screen.TwipsPerPixelX
                If lngOneAdded < 0 Then
                    '增加后小于最小宽度
                    Exit Sub
                ElseIf lngPosition(i, 2) + lngOneAdded > lngPosition(i, 3) Then
                    '增加后大于最大宽度
                    lngRowUsableWidth = lngRowUsableWidth - (lngPosition(i, 3) - lngPosition(i, 2))
                    lngSumMaxWidth = lngSumMaxWidth - lngPosition(i, 3)
                    lngPosition(i, 2) = lngPosition(i, 3)
                Else
                    lngRowUsableWidth = lngRowUsableWidth - lngOneAdded
                    lngSumMaxWidth = lngSumMaxWidth - lngPosition(i, 3)
                    lngPosition(i, 2) = lngPosition(i, 2) + lngOneAdded
                End If
            End If
        Next i

End Sub
Private Function blnFieldButtonAdjust() As Boolean
   '将FIELDBUTTON的位置LEFT,TOP,WIDTH 存于数组LNGPOSITION之第0,1,2列
   '如第四行不可见返回FALSE,否则返回TRUE
   
    Dim bln4RowIsVisible As Boolean
    Dim i As Integer, j As Integer
    Dim lngTop As Long, lngLeft As Long
    
    For i = 0 To frmName.lblField.UBound
        lngPosition(i, 2) = ((Field(i).bytMinSize * frmName.FontSize * 10) \ Screen.TwipsPerPixelX) * Screen.TwipsPerPixelX  '最小宽度
        lngPosition(i, 3) = ((Field(i).bytFieldSize * frmName.FontSize * 10) \ Screen.TwipsPerPixelX) * Screen.TwipsPerPixelX '最大宽度
    Next i
    
    For i = 1 To 4
        RowAdjust (i)     '行宽度调整
    Next i
        
    lngPosition(0, 0) = 8 * Screen.TwipsPerPixelX
    lngPosition(0, 1) = frmName.LblBack.Top + 3 * Screen.TwipsPerPixelX + intCaptionHeight + intFieldHeight + SpaceTwRow
 '   lngPosition(0, 2) = intField0width
    
    lngPosition(1, 0) = ((frmName.ScaleWidth - (intCmd0Width + 5 * Screen.TwipsPerPixelX) - 5 * Screen.TwipsPerPixelX _
                        - lngPosition(1, 2) - (2 + 7) * Screen.TwipsPerPixelX) \ Screen.TwipsPerPixelX) * Screen.TwipsPerPixelX     'LEFT
    lngPosition(1, 1) = frmName.LblBack.Top + 3 * Screen.TwipsPerPixelY          'TOP
    
    For i = 2 To frmName.lblField.Count - 1
        If Field(i).bytRow = Field(i - 1).bytRow Then
            lngPosition(i, 1) = lngPosition(i - 1, 1)        ' TOP
            If Field(i - 1).blnVisible Then
                'LEFT
                lngPosition(i, 0) = lngPosition(i - 1, 0) - lngPosition(i, 2) - SPACETWIPS
            Else
                'LEFT
                lngPosition(i, 0) = lngPosition(i - 1, 0) + lngPosition(i - 1, 2) - lngPosition(i, 2)
            End If
        Else
            lngPosition(i, 1) = lngPosition(i - 1, 1) + intCaptionHeight + intFieldHeight + SpaceTwRow
            lngPosition(i, 0) = lngPosition(1, 0) + lngPosition(1, 2) - lngPosition(i, 2)
        End If
        If Field(i).bytRow = 4 And Field(i).blnVisible Then
            bln4RowIsVisible = True
        End If
    Next i
    blnFieldButtonAdjust = bln4RowIsVisible
End Function
Private Sub FieldButton()
 'fields控件位置调整
    Dim i As Integer
    Dim bln4RowIsVisible
    bln4RowIsVisible = False
    
    frmName.LblBack.Move 3 * Screen.TwipsPerPixelX, _
                    frmName.LblBack.Top, _
                    frmName.ScaleWidth - intCmd0Width - (5 + 3 + 5 + 3) * Screen.TwipsPerPixelX, _
                    frmName.ScaleHeight - frmName.LblBack.Top - (3 + 5) * Screen.TwipsPerPixelY
    bln4RowIsVisible = blnFieldButtonAdjust
    
    For i = 0 To frmName.lblField.UBound
        frmName.lblFieldCaption(i).Move lngPosition(i, 0), lngPosition(i, 1), lngPosition(i, 2)
        If i = 0 Then
            frmName.lblField(i).Move lngPosition(i, 0), _
                         lngPosition(i, 1) + intCaptionHeight, _
                         lngPosition(i, 2), _
                         intCaptionHeight + intFieldHeight * 2 + SpaceTwRow
        Else
            frmName.lblField(i).Move lngPosition(i, 0), _
                         lngPosition(i, 1) + intCaptionHeight, _
                         lngPosition(i, 2)
        End If
    Next i
    
 '   frmname.lblField(0).Visible = True
 '   frmname.lblFieldCaption(0).Visible = True
    For i = 0 To frmName.lblField.Count - 1
         frmName.lblField(i).Visible = Field(i).blnVisible
         frmName.lblFieldCaption(i).Visible = frmName.lblField(i).Visible
    Next i
    Dim lngMemoTop As Long
    lngMemoTop = frmName.LblBack.Top + frmName.LblBack.Height - frmName.lblmemo(0).Height - 8 * Screen.TwipsPerPixelY
    
    frmName.lblmemo(0).Move frmName.LblBack.Left + 6 * Screen.TwipsPerPixelX, _
                 lngMemoTop
    
    frmName.lblmemo(3).Move frmName.LblBack.Left + frmName.LblBack.Width - 3 * Screen.TwipsPerPixelX - frmName.lblmemo(3).Width, _
               lngMemoTop
    frmName.lblmemo(2).Move frmName.lblmemo(3).Left - 3 * Screen.TwipsPerPixelX - frmName.lblmemo(2).Width, _
                      lngMemoTop
    frmName.lblmemo(1).Move frmName.lblmemo(0).Left + frmName.lblmemo(0).Width + 3 * Screen.TwipsPerPixelX, _
                 lngMemoTop, _
                 frmName.lblmemo(2).Left - 6 * Screen.TwipsPerPixelX - (frmName.lblmemo(0).Left + frmName.lblmemo(0).Width + 3 * Screen.TwipsPerPixelX)
    
    frmName.lblNote(0).Move frmName.LblBack.Left + 7 * Screen.TwipsPerPixelX, _
                    frmName.lblmemo(0).Top - frmName.lblNote(0).Height - 5 * Screen.TwipsPerPixelY
    
    frmName.lblNote(1).Move frmName.lblNote(0).Left + frmName.lblNote(0).Width + 5 * Screen.TwipsPerPixelX, _
                    frmName.lblNote(0).Top, _
                    frmName.LblBack.Left + frmName.LblBack.Width + 5 * Screen.TwipsPerPixelX _
                    - (2 * 3 + 5) * Screen.TwipsPerPixelX - (frmName.lblNote(0).Left + frmName.lblNote(0).Width + 5 * Screen.TwipsPerPixelX) - 7 * Screen.TwipsPerPixelX
    
    frmName.lblNote(0).Visible = True
    frmName.lblNote(1).Visible = True
    frmName.lblmemo(0).Visible = True
    frmName.lblmemo(1).Visible = True
    frmName.lblmemo(2).Visible = True
    frmName.lblmemo(3).Visible = True
    
    frmName.lblTotal(0).Caption = "合计"
    
    frmName.grdCol.Redraw = False
    Dim lngTop As Long
    lngTop = lngGrdTop(bln4RowIsVisible)
    frmName.grdCol.Move frmName.LblBack.Left + 6 * Screen.TwipsPerPixelX, _
                lngTop, _
                frmName.LblBack.Width - (2 * 3 + 7) * Screen.TwipsPerPixelX, _
                frmName.LblBack.Height - (lngTop - frmName.LblBack.Top) - 58 * Screen.TwipsPerPixelY
    grdColWidthAdjust
    TotalRowAdjust
    frmName.grdCol.Redraw = True
    
    For i = 0 To frmName.cmdButton.Count - 1
        frmName.cmdButton(i).Move frmName.ScaleWidth - frmName.cmdButton(i).Width - 5 * Screen.TwipsPerPixelX

⌨️ 快捷键说明

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