📄 frmdata.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{E228A480-FDCB-11D5-A3C8-0050BF074C3F}#2.0#0"; "curtPrinter.ocx"
Begin VB.Form frmData
Caption = "数据窗体"
ClientHeight = 8310
ClientLeft = 165
ClientTop = 735
ClientWidth = 10755
LinkTopic = "Form1"
ScaleHeight = 8310
ScaleWidth = 10755
StartUpPosition = 3 '窗口缺省
Begin CurtPrinter打印预览控件.CurtPrinter CurtPrinter1
Height = 1455
Left = 1680
TabIndex = 3
Top = 4440
Width = 2295
_ExtentX = 4048
_ExtentY = 2566
ForeColor = -2147483640
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSComctlLib.ImageList imlIcon
Left = 9840
Top = 3720
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmData.frx":0000
Key = "icon1"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmData.frx":031C
Key = "icon2"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmData.frx":0638
Key = "icon3"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmData.frx":0954
Key = "icon4"
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmData.frx":0C70
Key = "icon5"
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList imlSmallIcon
Left = 8040
Top = 5280
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmData.frx":0F8C
Key = "icon1"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmData.frx":12A8
Key = "icon2"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmData.frx":15C4
Key = "icon3"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmData.frx":18E0
Key = "icon4"
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmData.frx":1BFC
Key = "icon5"
EndProperty
EndProperty
End
Begin MSComctlLib.ListView ListView1
Height = 2415
Left = 360
TabIndex = 2
Top = 5400
Width = 10215
_ExtentX = 18018
_ExtentY = 4260
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "imlIcon"
SmallIcons = "imlSmallIcon"
ColHdrIcons = "imlSmallIcon"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
NumItems = 0
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 2175
Left = 0
TabIndex = 1
Top = 0
Width = 10215
_ExtentX = 18018
_ExtentY = 3836
_Version = 393216
BackColorFixed = 16777152
GridColor = -2147483633
GridColorFixed = 16777152
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "幼圆"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSHFlexGrid1
Height = 2895
Left = 120
TabIndex = 0
Top = 2280
Width = 10215
_ExtentX = 18018
_ExtentY = 5106
_Version = 393216
BackColorFixed = 16777152
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_NumberOfBands = 1
_Band(0).Cols = 2
End
Begin VB.Image Image1
Height = 480
Left = 7200
Picture = "frmData.frx":1F18
Top = 6600
Width = 480
End
Begin VB.Menu mnuDemo
Caption = "演示内容"
Begin VB.Menu mnuPreview
Caption = "预览"
End
Begin VB.Menu mnuPrint
Caption = "打印"
End
Begin VB.Menu mnuExit
Caption = "退出"
End
End
Begin VB.Menu mnuManual
Caption = "编码控制预览"
Enabled = 0 'False
Begin VB.Menu mnuPageUp
Caption = "上页"
End
Begin VB.Menu mnuPageDown
Caption = "下页"
End
Begin VB.Menu mnuZoom
Caption = "显示比例"
End
Begin VB.Menu mnuPaperSize
Caption = "选择纸张"
End
Begin VB.Menu mnuOrientation
Caption = "纸张方向"
End
End
End
Attribute VB_Name = "frmData"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'打印内容代码。预览或打印都是调用该代码的,也是大部分打印方法的演示
Public Sub PrintContent(Optional PrintDevice As Printer)
If Not PrintDevice Is Nothing Then
CurtPrinter1.StartPrint PrintDevice '打印到打印机
Else
CurtPrinter1.StartPrint '缺省是预览
End If
With CurtPrinter1
'第一页,编程打印,其实也是非常简单
.NewPage
.TitleOut "自定义打印测试(标题居中)", 15, vbCenter '打印标题
.textout "打印表格测试(默认字体设置):"
.newrow
'打印表格
.Font.Bold = True: .FontSize = 14 '此处不要用.Font.Size,否则缩放会出问题
.CellOut "姓名", 2000, vbLeftJustify, "2211", vbGrayText
.CellOut "年龄", 1000, vbCenter, "1211", vbGrayText
.CellOut "简介", 6000, , "1221", vbGrayText
.NewCellRow
.Font.Bold = False: .FontSize = 12 '此处不要用.Font.Size,否则缩放会出问题
.CellOut "王小二", 2000, vbLeftJustify, "2111"
.CellOut "22", 1000, vbCenter, "1111"
.CellOut "无业游民,喜欢偷鸡摸狗", 6000, , "1121"
.NewCellRow
.CellOut "王小三", 2000, vbLeftJustify, "2112"
.CellOut "33", 1000, vbCenter, "1112"
.CellOut "程序员,电脑的奴隶,但从不破坏工具来进行抵抗", 6000, , "1122"
.NewCellRow: .ForeColor = vbBlue
.textout "紧贴表格打印一行彩色文字"
.newrow: .ForeColor = vbBlack
.newrow
.textout "跳过一行打印文字"
'一些图形方法的演示
.FilledBoxOut 2 * .ScaleWidth / 3, 2 * .ScaleHeight / 3, 3 * .ScaleWidth / 5, 3 * .ScaleHeight / 5, vbBlue
.CircleOut .ScaleWidth / 2, .ScaleHeight / 2, 1000
.LineOut 0, 0, .ScaleWidth, .ScaleHeight '可打印的范围
.LineOut .ScaleWidth, 0, 0, .ScaleHeight
.PictureOut Image1.Picture, 2400, 2400, Image1.Width, Image1.Height
.BoxOut 0, 0, .ScaleWidth, .ScaleHeight, vbRed
'重新开始一页,直接打印报表,注意,它会自动换页,如果你设定了标题,它也自动打哦:)
.NewPage
'直接打印MSFlexGrid
.TitleOut "直接打印MSFlexGrid的测试,居中对齐"
.DirectPrint MSFlexGrid1, "测试MSFLEXGRID"
.newrow
'直接打印MSHFlexGrid
.TitleOut "直接打印MSHFlexGrid的测试,居中对齐"
.DirectPrint MSHFlexGrid1, "测试MSFLEXGRID"
.newrow
'根据控件的DirectPrint方法写的代码,大家可以参考来写自己的DirectPrint方法
.TitleOut "直接打印ListView的测试,居中对齐"
RefDirectPrint ListView1, "测试LISTVIEW"
.newrow
' 支持DATEGRID的直接打印,用法同上,不提供例子了
'结束打印
.EndDoc
End With
End Sub
Private Sub mnuExit_Click()
Unload Me
End Sub
'预览的代码
Private Sub mnuPreview_Click()
CurtPrinter1.Visible = True
mnuManual.Enabled = True
PrintContent
End Sub
'两行代码可选,一个会调用打印对话框,一个直接打印了。
Private Sub mnuPrint_Click()
CurtPrinter1.ShowPrinter
'PrintContent Printer
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -