📄 frmprint.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form frmprint
Caption = "打印文本"
ClientHeight = 6195
ClientLeft = 4185
ClientTop = 2940
ClientWidth = 7725
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form2"
Picture = "frmprint.frx":0000
ScaleHeight = 6195
ScaleWidth = 7725
Begin MSComDlg.CommonDialog CommonDialog2
Left = 7080
Top = 480
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 6480
Top = 480
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command3
BackColor = &H0000FFFF&
Caption = "结束打印"
Height = 495
Left = 6000
Style = 1 'Graphical
TabIndex = 5
Top = 4920
Width = 1575
End
Begin VB.CommandButton Command2
BackColor = &H0000FFFF&
Caption = "打印文本"
Height = 495
Left = 6000
Style = 1 'Graphical
TabIndex = 4
Top = 4080
Width = 1575
End
Begin VB.CommandButton Command1
BackColor = &H0000FFFF&
Caption = "选择文本"
BeginProperty Font
Name = "新宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6000
Style = 1 'Graphical
TabIndex = 3
Top = 3240
Width = 1575
End
Begin VB.Frame Frame1
BackColor = &H008080FF&
Caption = "显示内容"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 5055
Left = 240
TabIndex = 0
Top = 960
Width = 5295
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4695
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 2
Text = "frmprint.frx":4BD0D
Top = 240
Width = 5055
End
End
Begin VB.Image Image1
Height = 480
Left = 5760
Picture = "frmprint.frx":4BD14
Top = 360
Width = 480
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "选择文本打印文本"
BeginProperty Font
Name = "华文新魏"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 1080
TabIndex = 1
Top = 240
Width = 4095
End
Begin VB.Line Line1
BorderColor = &H000000FF&
X1 = 600
X2 = 5760
Y1 = 840
Y2 = 840
End
End
Attribute VB_Name = "frmprint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Text1.Text = ""
On Error GoTo errhandler ' 出错时直接跳到errhandler,然后往下执行
CommonDialog1.Filter = "Text files(*.txt) | *.txt" ' 限制通用对话框中可以打开的文件类型文.txt
CommonDialog1.FilterIndex = 1
CommonDialog1.Action = 1
Open CommonDialog1.FileName For Input As #1
While Not EOF(1)
Line Input #1, Lstr
Text1.Text = Text1.Text + Lstr + Chr(13) + Chr(10)
Wend
Close #1
errhandler:
Exit Sub
End Sub
Private Sub Command2_Click()
Dim spage, epage, numpage, i
CommonDialog2.CancelError = True
On Error GoTo handler
CommonDialog2.ShowPrinter
spage = CommonDialog2.FromPage
epage = CommonDialog2.ToPage
numpage = CommonDialog2.Copies
For i = 1 To numpage
'此处设置代码进行打印作业
Next i
handler:
Exit Sub
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text1.Text = "请单击打开按钮,装载文本。"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -