frmmodcommonprintsetup.frm

来自「通用书店管理系统」· FRM 代码 · 共 1,707 行 · 第 1/5 页

FRM
1,707
字号
            End
            Begin VB.Label lblFields 
               AutoSize        =   -1  'True
               Caption         =   "标签宽度"
               Height          =   180
               Index           =   23
               Left            =   2460
               TabIndex        =   51
               Top             =   615
               Width           =   720
            End
            Begin VB.Label lblFields 
               AutoSize        =   -1  'True
               Caption         =   "文本宽度"
               Height          =   180
               Index           =   24
               Left            =   2460
               TabIndex        =   50
               Top             =   975
               Width           =   720
            End
         End
         Begin VB.Frame fraBodyLayoutText 
            BorderStyle     =   0  'None
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   5.25
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   1485
            Left            =   60
            TabIndex        =   40
            Top             =   1605
            Width           =   4230
            Begin VB.TextBox txtLayout 
               Height          =   1035
               Left            =   60
               MultiLine       =   -1  'True
               ScrollBars      =   2  'Vertical
               TabIndex        =   41
               Top             =   420
               Width           =   4110
            End
            Begin VB.Label lblFields 
               AutoSize        =   -1  'True
               BackStyle       =   0  'Transparent
               Caption         =   "布局文本:"
               Height          =   180
               Index           =   3
               Left            =   150
               TabIndex        =   42
               Top             =   135
               Width           =   900
            End
         End
         Begin VB.Label lblFields 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "内容文本:"
            Height          =   180
            Index           =   2
            Left            =   105
            TabIndex        =   58
            Top             =   240
            Width           =   900
         End
      End
   End
   Begin VB.CommandButton cmdDelete 
      Caption         =   "清除"
      Height          =   345
      Left            =   1140
      TabIndex        =   4
      Top             =   5850
      Width           =   795
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "保存(&S)"
      Height          =   345
      Left            =   195
      TabIndex        =   3
      Top             =   5850
      Width           =   810
   End
   Begin VB.CommandButton cmdReset 
      Caption         =   "复位(&R)"
      Height          =   330
      Left            =   2805
      TabIndex        =   2
      Top             =   5865
      Width           =   915
   End
   Begin MSComDlg.CommonDialog cd 
      Left            =   2880
      Top             =   4695
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "取消(&X)"
      Height          =   330
      Left            =   6240
      TabIndex        =   1
      Top             =   5880
      Width           =   1080
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "确定(&K)"
      Height          =   330
      Left            =   4755
      TabIndex        =   0
      Top             =   5880
      Width           =   1050
   End
End
Attribute VB_Name = "frmModCommonPrintSetup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Public strDBMainTable As String         '保存到数据库的主表名称
Public strDBDetailTable As String       '保存到数据库的明细表名称

Public blnOK As Boolean                 '是否确定
Public blnOptPageRange_0 As Boolean     '可选项
Public strTxtPageRange As String        '打印哪些页
Public strTxtCopyQty As String          '打印份数
Public PrintInfo As ClsPrintInfo        '打印信息
Public strPrintInfoName As String       '打印信息名称
Public frmParent As frmModCommonPrint   '传送打印窗体的引用

Public PrintMarginLeft As Double        '左边距
Public PrintMarginRight As Double       '右边距
Public PrintMarginHeader As Double      '上边距
Public PrintMarginFooter As Double      '下边距
Public PrintOrientation As EnumPrintOrientation      '打印方向
Public PrintPaperSize As PaperSizeSettings        '打印纸代号
Public PrintPaperWidth As Double        '打印纸宽度
Public PrintPaperHeight As Double       '打印纸高度

Public intPrintModel As Integer             '打印模式

Private PI As New ClsPrintInfo          '保存动态信息

Dim blnChangedByQuery As Boolean        '表明是否查询引发数据改变

Private Sub iniForm()
    Dim strContent$, strLayout$
    Dim arrContent, i%
    
    tv.Nodes.Clear
    '页眉
    Call tv.Nodes.Add(, , "页眉", "页眉", "closeParent", "closeParent")
    '正标题
    Call tv.Nodes.Add(, , "正标题", "正标题", "closeParent", "closeParent")
    '副标题
    Call tv.Nodes.Add(, , "副标题", "副标题", "closeParent", "closeParent")
    '表前叙述
    Call tv.Nodes.Add(, , "表前叙述", "表前叙述", "closeParent", "openParent")
    With PrintInfo.cqSayingAboveTable
        strContent = Trim(.Content & "")
        If strContent <> "" Then
            arrContent = Split(strContent, "|")
            For i = 0 To UBound(arrContent)
                If (i Mod 2) = 0 Then _
                    Call tv.Nodes.Add("表前叙述", tvwChild, Trim(arrContent(i)) & "_表前叙述" & i, Trim(arrContent(i)), "leaf", "leaf")
            Next i
        End If
    End With
    '表格
    Call tv.Nodes.Add(, , "表格", "表格", "closeParent", "openParent")
    With PrintInfo.cqTable
        strContent = Trim(.LayOut & "")
        strContent = g_GetValueByString("", "Header", strContent)
        If strContent <> "" Then
            arrContent = Split(strContent, "|")
            For i = 0 To UBound(arrContent)
                Call tv.Nodes.Add("表格", tvwChild, Trim(arrContent(i)) & "_表格" & i, Trim(arrContent(i)), "leaf", "leaf")
            Next i
        End If
    End With
    '表尾叙述
    Call tv.Nodes.Add(, , "表尾叙述", "表尾叙述", "closeParent", "openParent")
    With PrintInfo.cqSayingBelowTable
        strContent = Trim(.Content & "")
        If strContent <> "" Then
            arrContent = Split(strContent, "|")
            For i = 0 To UBound(arrContent)
                If (i Mod 2) = 0 Then _
                    Call tv.Nodes.Add("表尾叙述", tvwChild, Trim(arrContent(i)) & "_表尾叙述" & i, Trim(arrContent(i)), "leaf", "leaf")
            Next i
        End If
    End With
    '签名
    Call tv.Nodes.Add(, , "签名", "签名", "closeParent", "openParent")
    With PrintInfo.cqSign
        strContent = Trim(.Content & "")
        If strContent <> "" Then
            arrContent = Split(strContent, "|")
            For i = 0 To UBound(arrContent)
                If (i Mod 2) = 0 Then _
                    Call tv.Nodes.Add("签名", tvwChild, Trim(arrContent(i)) & "_签名" & i, Trim(arrContent(i)), "leaf", "leaf")
            Next i
        End If
    End With
    '页脚
    Call tv.Nodes.Add(, , "页脚", "页脚", "closeParent", "closeParent")
    
    Call CopyPrintInfoToPI(True)   '复制对象
    
    '初始化参数——“内容显示”
    Me.chkRepeat(0).Value = IIf(frmParent.blnRepeatTitle, vbChecked, 0)
    Me.chkRepeat(1).Value = IIf(frmParent.blnRepeatSayingAboveTable, vbChecked, 0)
    Me.chkRepeat(2).Value = IIf(frmParent.blnRepeatSayingBelowTable, vbChecked, 0)
    Me.chkRepeat(3).Value = IIf(frmParent.blnRepeatSign, vbChecked, 0)
        
    '初始化参数——表格参数
    Me.chkColumnForPage.Value = IIf(frmParent.blnColumnForPage, vbChecked, 0)
    Me.chkTableExtenLastCol = IIf(frmParent.blnExtenLastCol, vbChecked, 0)
    Me.chkTableEmptyRow = IIf(frmParent.blnEmptyRow, vbChecked, 0)
    Me.txtRowHeight = frmParent.Row_Height
    Me.txtMaxRows = frmParent.MaxRowsPerPage
    
    '初始化参数——页码设置
    Dim strPageOf As String
    Dim strPageOfFormat$, strPageOfPosType$, strPageOfPosXY$
    Dim arrPageOfPosXY() As String
    strPageOf = PI.cqPageFoot.LayOut
    If strPageOf = "" Then
        strPageOf = "PageOf "       '向前兼容,进行数据初始化工作
        PI.cqPageFoot.LayOut = strPageOf
    End If
    strPageOfFormat = g_GetValueByString(strPageOfFormat, "PageOfFormat", strPageOf)
    strPageOfPosType = g_GetValueByString(strPageOfPosType, "PageOfPosType", strPageOf)
    strPageOfPosXY = g_GetValueByString(strPageOfPosXY, "PageOfPosXY", strPageOf)
    cboPageOfFormat.Text = strPageOfFormat
    cboPageOfPosition.Text = strPageOfPosType
    If strPageOfPosType = "自定义" Then
        arrPageOfPosXY = Split(strPageOfPosXY, ",")
        If UBound(arrPageOfPosXY) = 1 Then
            txtPageOfPositionX.Text = arrPageOfPosXY(0)
            txtPageOfPositionY.Text = arrPageOfPosXY(1)
        End If
    End If
    
    With fraGrid
        .Visible = False
        .Left = 2750
        .Top = 450
        .Height = 4600
        .Width = 4600
    End With
    With fraText
        .Visible = False
        .Left = fraGrid.Left
        .Top = fraGrid.Top
        .Width = fraGrid.Width
        .Height = fraGrid.Height
    End With
    With fraParent
        .Visible = False
        .Left = fraGrid.Left
        .Top = fraGrid.Top
        .Width = fraGrid.Width
        .Height = fraGrid.Height
    End With
    
    Me.optPrintModel(intPrintModel).Value = True
    
End Sub
Private Sub CancelButton_Click()
    blnOK = False
    Unload Me
End Sub

Private Sub cboLayoutAllBodyAlign_Click()
    '触发内容替换
    If blnChangedByQuery Then Exit Sub
    
    Select Case cboLayoutAllBodyAlign.Text
    Case "左"
        Call UpdatePrintInfo(tv.SelectedItem, "Body", "Align", "Left")
    Case "中"
        Call UpdatePrintInfo(tv.SelectedItem, "Body", "Align", "Center")
    Case "右"
        Call UpdatePrintInfo(tv.SelectedItem, "Body", "Align", "Right")
    End Select
    
End Sub

Private Sub cboLayoutAllLabelAlign_Click()
    '触发内容替换
    If blnChangedByQuery Then Exit Sub
    
    Select Case cboLayoutAllLabelAlign.Text
    Case "左"
        Call UpdatePrintInfo(tv.SelectedItem, "Label", "Align", "Left")
    Case "中"
        Call UpdatePrintInfo(tv.SelectedItem, "Label", "Align", "Center")
    Case "右"
        Call UpdatePrintInfo(tv.SelectedItem, "Label", "Align", "Right")
    End Select
End Sub

Private Sub cboLayoutAllTextAlign_Click()
    '触发内容替换
    If blnChangedByQuery Then Exit Sub
    
    Select Case cboLayoutAllTextAlign.Text
    Case "左"
        Call UpdatePrintInfo(tv.SelectedItem, "Text", "Align", "Left")
    Case "中"
        Call UpdatePrintInfo(tv.SelectedItem, "Text", "Align", "Center")
    Case "右"
        Call UpdatePrintInfo(tv.SelectedItem, "Text", "Align", "Right")
    End Select
End Sub

Private Sub cboLayoutColAlign_Click()
    updateTableColumnFormat
End Sub

Private Sub cboLayoutColFormat_Click()
    updateTableColumnFormat
End Sub

Private Sub cboLayoutColFormat_Validate(Cancel As Boolean)
    updateTableColumnFormat
End Sub

Private Sub cboLayoutColViewZero_Click()
    updateTableColumnFormat
End Sub

⌨️ 快捷键说明

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