📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "打印设置"
ClientHeight = 3090
ClientLeft = 5370
ClientTop = 4155
ClientWidth = 4680
LinkTopic = "Form2"
LockControls = -1 'True
ScaleHeight = 3090
ScaleWidth = 4680
Begin VB.CommandButton Command1
Caption = "确 定"
Height = 750
Left = 3675
TabIndex = 2
Top = 1890
Width = 675
End
Begin VB.Frame Frame2
Caption = "页面边距"
Height = 1605
Left = 105
TabIndex = 1
Top = 1365
Width = 3435
Begin VB.TextBox Text2
Height = 270
Left = 1170
TabIndex = 16
Top = 1095
Width = 315
End
Begin VB.TextBox Text1
Height = 270
Left = 1177
TabIndex = 15
Top = 405
Width = 330
End
Begin VB.VScrollBar VScroll1
Height = 255
Left = 1455
Max = 100
TabIndex = 14
Top = 405
Width = 195
End
Begin VB.VScrollBar VScroll2
Height = 255
Left = 1455
Max = 100
TabIndex = 13
Top = 1095
Width = 195
End
Begin VB.VScrollBar VScroll4
Height = 255
Left = 3150
Max = 100
TabIndex = 12
Top = 1095
Width = 195
End
Begin VB.VScrollBar VScroll3
Height = 255
Left = 3150
Max = 100
TabIndex = 11
Top = 405
Width = 195
End
Begin VB.TextBox Text3
Height = 270
Left = 2865
TabIndex = 8
Top = 390
Width = 315
End
Begin VB.TextBox Text4
Height = 270
Left = 2865
TabIndex = 6
Top = 1095
Width = 300
End
Begin VB.Label Label2
Caption = "下边距(毫米)"
Height = 285
Left = 60
TabIndex = 18
Top = 1155
Width = 1140
End
Begin VB.Label Label1
Caption = "上边距(毫米)"
Height = 285
Left = 45
TabIndex = 17
Top = 465
Width = 1080
End
Begin VB.Label Label3
Caption = "左边距(毫米)"
Height = 285
Left = 1770
TabIndex = 7
Top = 465
Width = 1110
End
Begin VB.Label Label4
Caption = "右边距(毫米)"
Height = 285
Left = 1785
TabIndex = 5
Top = 1155
Width = 1245
End
End
Begin VB.Frame Frame1
Caption = "纸张方向"
Height = 1065
Left = 90
TabIndex = 0
Top = 165
Width = 4035
Begin VB.PictureBox Picture2
Appearance = 0 'Flat
AutoSize = -1 'True
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 360
Left = 3330
Picture = "Form2.frx":0000
ScaleHeight = 360
ScaleWidth = 465
TabIndex = 10
Top = 397
Width = 465
End
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
AutoSize = -1 'True
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 465
Left = 885
Picture = "Form2.frx":0420
ScaleHeight = 465
ScaleWidth = 375
TabIndex = 9
Top = 345
Width = 375
End
Begin VB.OptionButton Option2
Caption = "横向"
Height = 285
Left = 2610
TabIndex = 4
Top = 435
Width = 1290
End
Begin VB.OptionButton Option1
Caption = "纵向"
Height = 285
Left = 210
TabIndex = 3
Top = 435
Value = -1 'True
Width = 1290
End
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim a, b, c, d As Integer
If Option1.Value = True Then
Form1.VSPrinter1.Orientation = orPortrait
Else
Form1.VSPrinter1.Orientation = orLandscape
End If
a = Text1.Text
b = Text2.Text
c = Text3.Text
d = Text4.Text
Form1.VSPrinter1.MarginTop = a * 72
Form1.VSPrinter1.MarginBottom = b * 72
Form1.VSPrinter1.MarginLeft = c * 72
Form1.VSPrinter1.MarginRight = d * 72
Form1.VSPrinter1.StartDoc
Form1.VSPrinter1.FontSize = 24
Form1.VSPrinter1.FontBold = True
Form1.VSPrinter1.TextAlign = taCenterMiddle
Form1.VSPrinter1.Paragraph = "XX这是标题这是标题"
Form1.VSPrinter1.Paragraph = ""
Form1.VSPrinter1.Zoom = 100 '显示比例为100%
Form1.VSPrinter1.RenderControl = Form1.VSFG1.hWnd
Form1.VSPrinter1.EndDoc
Form1.VSPrinter1.Refresh
Form2.Hide
End Sub
Private Sub Form_Load()
If Form1.VSPrinter1.Orientation = orPortrait Then
Option1.Value = True
Else
Option2.Value = True
End If
VScroll1.Value = Int(Form1.VSPrinter1.MarginTop / 72)
VScroll2.Value = Int(Form1.VSPrinter1.MarginBottom / 72)
VScroll3.Value = Int(Form1.VSPrinter1.MarginLeft / 72)
VScroll4.Value = Int(Form1.VSPrinter1.MarginRight / 72)
Text1.Text = VScroll1.Value
Text2.Text = VScroll2.Value
Text3.Text = VScroll3.Value
Text4.Text = VScroll4.Value
End Sub
Private Sub VScroll1_Change()
Text1.Text = VScroll1.Value
End Sub
Private Sub VScroll2_Change()
Text2.Text = VScroll2.Value
End Sub
Private Sub VScroll3_Change()
Text3.Text = VScroll3.Value
End Sub
Private Sub VScroll4_Change()
Text4.Text = VScroll4.Value
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -