📄 frmprintsetup.frm
字号:
VERSION 5.00
Begin VB.Form FrmPrintSetup
Caption = "打印预览"
ClientHeight = 7455
ClientLeft = 2205
ClientTop = 1695
ClientWidth = 9510
MDIChild = -1 'True
ScaleHeight = 7455
ScaleWidth = 9510
Begin VB.CommandButton Command2
Caption = "打印"
Height = 495
Left = 360
TabIndex = 2
Top = 1920
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 360
TabIndex = 1
Top = 480
Width = 1215
End
Begin VB.PictureBox PicPaper
Appearance = 0 'Flat
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 6615
Left = 3720
ScaleHeight = 6585
ScaleWidth = 5025
TabIndex = 0
Top = 120
Width = 5055
End
End
Attribute VB_Name = "FrmPrintSetup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
PicPaper.Cls
PrintPaperLine
Printer.ScaleMode = 0
Printer.ScaleHeight = PicPaper.ScaleHeight
Printer.ScaleLeft = PicPaper.ScaleLeft
Printer.ScaleTop = PicPaper.ScaleTop
Printer.ScaleWidth = PicPaper.ScaleWidth
MsgBox "printer.width=" & Printer.Width '11904
MsgBox "printer.height=" & Printer.Height '16836
MsgBox "picpaper.width=" & PicPaper.Width
MsgBox "picpaper.height=" & PicPaper.Height
End Sub
Private Sub Command2_Click()
Printer.CurrentX = 0
Printer.CurrentY = 0
Printer.Line (0, 0)-(5000, 0)
Printer.EndDoc
End Sub
Private Sub Form_Load()
Me.Left = 200
Me.Width = 12000
Me.Top = 200
Me.Height = 9000
PicPaper.Left = Me.Width * 0.35
PicPaper.Top = 100
PicPaper.Height = Me.Height * 0.93
PicPaper.Width = PicPaper.Height * 0.75
End Sub
Private Sub Form_Resize()
PicPaper.Left = Me.Width * 0.35
PicPaper.Top = 100
PicPaper.Height = Me.Height * 0.9
PicPaper.Width = PicPaper.Height * 0.75
End Sub
Private Sub PrintPaperLine()
PicPaper.Cls
'打印页上两角
PicPaper.Line (PicPaper.Width * 0.05, PicPaper.Height * 0.07)-(PicPaper.Width * 0.08, PicPaper.Height * 0.07)
PicPaper.Line (PicPaper.Width * 0.08, PicPaper.Height * 0.05)-(PicPaper.Width * 0.08, PicPaper.Height * 0.07)
PicPaper.Line (PicPaper.Width * 0.91, PicPaper.Height * 0.05)-(PicPaper.Width * 0.91, PicPaper.Height * 0.07)
PicPaper.Line (PicPaper.Width * 0.91, PicPaper.Height * 0.07)-(PicPaper.Width * 0.94, PicPaper.Height * 0.07)
'打印页下两角
PicPaper.Line (PicPaper.Width * 0.05, PicPaper.Height * 0.93)-(PicPaper.Width * 0.08, PicPaper.Height * 0.93)
PicPaper.Line (PicPaper.Width * 0.08, PicPaper.Height * 0.93)-(PicPaper.Width * 0.08, PicPaper.Height * 0.95)
PicPaper.Line (PicPaper.Width * 0.91, PicPaper.Height * 0.93)-(PicPaper.Width * 0.94, PicPaper.Height * 0.93)
PicPaper.Line (PicPaper.Width * 0.91, PicPaper.Height * 0.95)-(PicPaper.Width * 0.91, PicPaper.Height * 0.93)
End Sub
Private Sub PicPaper_Paint()
PrintPaperLine
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -