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

📄 setprn.frm

📁 该控件是一个针对Access 数据库而设计的查询/分组统计/打印/预览一体化控件。该控件需要 VB5/SP3 支持。 随控件一起提供了一个例子
💻 FRM
字号:
VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
Begin VB.Form SetPrn 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "报表打印设置"
   ClientHeight    =   3840
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6165
   Icon            =   "SetPrn.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3840
   ScaleWidth      =   6165
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin MSComDlg.CommonDialog Dlg1 
      Left            =   1560
      Top             =   3240
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   327681
   End
   Begin VB.CommandButton Command2 
      Cancel          =   -1  'True
      Caption         =   "取 消"
      Height          =   375
      Left            =   4680
      TabIndex        =   2
      Top             =   3360
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确 认"
      Default         =   -1  'True
      Height          =   375
      Left            =   3240
      TabIndex        =   1
      Top             =   3360
      Width           =   1215
   End
   Begin TabDlg.SSTab SSTab1 
      Height          =   2895
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   5895
      _ExtentX        =   10398
      _ExtentY        =   5106
      _Version        =   327681
      Style           =   1
      TabsPerRow      =   4
      TabHeight       =   520
      TabCaption(0)   =   "标题"
      TabPicture(0)   =   "SetPrn.frx":000C
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "Label1"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).Control(1)=   "lbl_Title"
      Tab(0).Control(1).Enabled=   0   'False
      Tab(0).Control(2)=   "txt_Title"
      Tab(0).Control(2).Enabled=   0   'False
      Tab(0).Control(3)=   "Command3"
      Tab(0).Control(3).Enabled=   0   'False
      Tab(0).ControlCount=   4
      TabCaption(1)   =   "表格"
      TabPicture(1)   =   "SetPrn.frx":0028
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "Option1(2)"
      Tab(1).Control(1)=   "Option1(1)"
      Tab(1).Control(2)=   "Option1(0)"
      Tab(1).Control(3)=   "Command5"
      Tab(1).Control(4)=   "Command4"
      Tab(1).Control(5)=   "Label2"
      Tab(1).Control(6)=   "lbl_Body"
      Tab(1).Control(7)=   "lbl_Head"
      Tab(1).ControlCount=   8
      TabCaption(2)   =   "汇总"
      TabPicture(2)   =   "SetPrn.frx":0044
      Tab(2).ControlEnabled=   0   'False
      Tab(2).Control(0)=   "txt_Foot"
      Tab(2).Control(1)=   "chk_Bold"
      Tab(2).Control(2)=   "chk_Center"
      Tab(2).Control(3)=   "chk_UnderLine"
      Tab(2).Control(4)=   "chk_Sum"
      Tab(2).Control(5)=   "chk_PrnDate"
      Tab(2).Control(6)=   "Label3"
      Tab(2).ControlCount=   7
      Begin VB.TextBox txt_Foot 
         Height          =   375
         Left            =   -70440
         TabIndex        =   20
         Text            =   "Text1"
         Top             =   2160
         Width           =   855
      End
      Begin VB.CheckBox chk_Bold 
         Caption         =   "合计栏加重"
         Height          =   375
         Left            =   -71520
         TabIndex        =   19
         Top             =   1560
         Width           =   1935
      End
      Begin VB.CheckBox chk_Center 
         Caption         =   "合计栏居中"
         Height          =   375
         Left            =   -74520
         TabIndex        =   18
         Top             =   2040
         Width           =   1935
      End
      Begin VB.CheckBox chk_UnderLine 
         Caption         =   "合计栏加下划线"
         Height          =   375
         Left            =   -74520
         TabIndex        =   17
         Top             =   1560
         Width           =   1935
      End
      Begin VB.CheckBox chk_Sum 
         Caption         =   "打印表格总汇总"
         Height          =   375
         Left            =   -74520
         TabIndex        =   16
         Top             =   1080
         Width           =   1695
      End
      Begin VB.CheckBox chk_PrnDate 
         Caption         =   "打印当前日期"
         Height          =   375
         Left            =   -74520
         TabIndex        =   15
         Top             =   600
         Width           =   1695
      End
      Begin VB.OptionButton Option1 
         Caption         =   "居右"
         Height          =   255
         Index           =   2
         Left            =   -70920
         TabIndex        =   14
         Top             =   600
         Width           =   975
      End
      Begin VB.OptionButton Option1 
         Caption         =   "居中"
         Height          =   255
         Index           =   1
         Left            =   -71880
         TabIndex        =   13
         Top             =   600
         Width           =   975
      End
      Begin VB.OptionButton Option1 
         Caption         =   "居左"
         Height          =   255
         Index           =   0
         Left            =   -72840
         TabIndex        =   12
         Top             =   600
         Width           =   975
      End
      Begin VB.CommandButton Command5 
         Caption         =   "字体设置"
         Height          =   375
         Left            =   -71400
         TabIndex        =   10
         Top             =   1080
         Width           =   1215
      End
      Begin VB.CommandButton Command4 
         Caption         =   "字体设置"
         Height          =   375
         Left            =   -74520
         TabIndex        =   9
         Top             =   1080
         Width           =   1215
      End
      Begin VB.CommandButton Command3 
         Caption         =   "字体设置"
         Height          =   375
         Left            =   4320
         TabIndex        =   5
         Top             =   1440
         Width           =   1215
      End
      Begin VB.TextBox txt_Title 
         Height          =   375
         Left            =   1320
         TabIndex        =   3
         Text            =   "Text1"
         Top             =   960
         Width           =   4215
      End
      Begin VB.Label Label3 
         Caption         =   "页面调整:"
         Height          =   255
         Left            =   -71520
         TabIndex        =   21
         Top             =   2160
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "表格打印位置: "
         Height          =   375
         Left            =   -74520
         TabIndex        =   11
         Top             =   600
         Width           =   1455
      End
      Begin VB.Label lbl_Body 
         Caption         =   "表格内容"
         Height          =   375
         Left            =   -70920
         TabIndex        =   8
         Top             =   1680
         Width           =   1095
      End
      Begin VB.Label lbl_Head 
         Caption         =   "打印表头"
         Height          =   375
         Left            =   -73920
         TabIndex        =   7
         Top             =   1680
         Width           =   735
      End
      Begin VB.Label lbl_Title 
         Alignment       =   2  'Center
         Caption         =   "打印标题"
         Height          =   255
         Left            =   240
         TabIndex        =   6
         Top             =   1980
         Width           =   5415
      End
      Begin VB.Label Label1 
         Caption         =   "打印标题"
         Height          =   255
         Left            =   240
         TabIndex        =   4
         Top             =   900
         Width           =   1335
      End
   End
End
Attribute VB_Name = "SetPrn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command2_Click()
  Unload Me
End Sub

Private Sub Command3_Click()
  SetObjFont lbl_Title
End Sub

Private Sub Command4_Click()
  SetObjFont lbl_Head
End Sub

Private Sub Command5_Click()
  SetObjFont lbl_Body
End Sub

Private Sub Form_Load()
  With A_lookview
    txt_Title = .Title
    lbl_Title.FontName = .GetFont("title", 0)
    lbl_Title.FontSize = .GetFont("Title", 1)
    lbl_Title.FontBold = .GetFont("Title", 2)
    lbl_Title.FontItalic = .GetFont("Title", 3)
    lbl_Title.FontUnderline = .GetFont("title", 4)
    lbl_Title.AutoSize = True
    lbl_Title = txt_Title
    
    lbl_Head.FontName = .GetFont("Head", 0)
    lbl_Head.FontSize = .GetFont("Head", 1)
    lbl_Head.FontBold = .GetFont("Head", 2)
    lbl_Head.FontItalic = .GetFont("Head", 3)
    lbl_Head.FontUnderline = .GetFont("Head", 4)
    lbl_Head.AutoSize = True
    
    lbl_Body.FontName = .GetFont("Body", 0)
    lbl_Body.FontSize = .GetFont("Body", 1)
    lbl_Body.FontBold = .GetFont("Body", 2)
    lbl_Body.FontItalic = .GetFont("Body", 3)
    lbl_Body.FontUnderline = .GetFont("Body", 4)
    lbl_Body.AutoSize = True
    
    txt_Foot = .FootMargin
    
    chk_PrnDate = IIf(.ShowPrnDate, 1, 0)
    chk_Sum = IIf(.GetSumProperty(0), 1, 0)
    chk_UnderLine = IIf(.GetSumProperty(1), 1, 0)
    chk_Center = IIf(.GetSumProperty(2), 1, 0)
    chk_Bold = IIf(.GetSumProperty(3), 1, 0)
    Option1(.BGAlig).Value = True
  End With
End Sub

Private Sub Command1_Click()
  Dim i As Integer
  With A_lookview
    .Title = txt_Title
    .SetFont "title", 0, lbl_Title.FontName
    .SetFont "Title", 1, lbl_Title.FontSize
    .SetFont "Title", 2, lbl_Title.FontBold
    .SetFont "Title", 3, lbl_Title.FontItalic
    .SetFont "title", 4, lbl_Title.FontUnderline
    
    .SetFont "Head", 0, lbl_Head.FontName
    .SetFont "Head", 1, lbl_Head.FontSize
    .SetFont "Head", 2, lbl_Head.FontBold
    .SetFont "Head", 3, lbl_Head.FontItalic
    .SetFont "Head", 4, lbl_Head.FontUnderline

    
    .SetFont "Body", 0, lbl_Body.FontName
    .SetFont "Body", 1, lbl_Body.FontSize
    .SetFont "Body", 2, lbl_Body.FontBold
    .SetFont "Body", 3, lbl_Body.FontItalic
    .SetFont "Body", 4, lbl_Body.FontUnderline
    
    .ShowPrnDate = (chk_PrnDate = 1)
    .SetSumProperty 0, (chk_Sum = 1)
    .SetSumProperty 1, (chk_UnderLine = 1)
    .SetSumProperty 2, (chk_Center = 1)
    .SetSumProperty 3, (chk_Bold = 1)
    
    If .FootMargin <> Val(txt_Foot) Then
      .FootMargin = Val(txt_Foot)
'      SaveSetting A_AppName, A_SecName, "Foot", txt_Foot
    End If
    
    For i = 0 To 2
      If Option1(i).Value = True Then
        .BGAlig = i
        Exit For
      End If
    Next
  End With
  Unload Me
End Sub

Private Sub txt_Title_Change()
    lbl_Title = txt_Title

End Sub


Private Sub SetObjFont(Obj1 As Control)
  With Obj1
  Dlg1.Flags = cdlCFBoth
  Dlg1.FontBold = .FontBold
  Dlg1.FontSize = .FontSize
  Dlg1.FontItalic = .FontItalic
  Dlg1.FontName = .FontName
  On Error GoTo ErrHand
  Dlg1.ShowFont
  
  .FontBold = Dlg1.FontBold
  .FontSize = Dlg1.FontSize
  .FontItalic = Dlg1.FontItalic
  .FontName = Dlg1.FontName
  
  End With
ErrHand:
  'CommDlgs.DialogFont Me.hWnd, lbl_Title
End Sub

⌨️ 快捷键说明

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