form1.frm
来自「本文件包含200个visual baisc实例」· FRM 代码 · 共 219 行
FRM
219 行
VERSION 5.00
Begin VB.Form Form1
Caption = "可视化信封打印"
ClientHeight = 4905
ClientLeft = 60
ClientTop = 345
ClientWidth = 8985
LinkTopic = "Form1"
ScaleHeight = 4905
ScaleWidth = 8985
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox text1
Height = 345
Index = 2
Left = 2670
TabIndex = 11
Top = 1845
Width = 2610
End
Begin VB.TextBox text1
Height = 450
Index = 1
Left = 1260
TabIndex = 10
Top = 960
Width = 6945
End
Begin VB.TextBox text1
Height = 345
Index = 0
Left = 1275
TabIndex = 9
Top = 180
Width = 1740
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 480
Left = 6855
TabIndex = 8
Top = 4020
Width = 1710
End
Begin VB.CommandButton Command1
Caption = "打印"
Height = 480
Left = 4920
TabIndex = 7
Top = 4035
Width = 1710
End
Begin VB.TextBox text1
Height = 375
Index = 4
Left = 5250
TabIndex = 6
Top = 3240
Width = 3015
End
Begin VB.TextBox text1
Height = 450
Index = 3
Left = 3420
TabIndex = 0
Top = 2625
Width = 4830
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "邮政编码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 4050
TabIndex = 5
Top = 3300
Width = 1395
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "寄信人:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 2490
TabIndex = 4
Top = 2700
Width = 1110
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "收信人:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 1680
TabIndex = 3
Top = 1845
Width = 1110
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "地址:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 600
TabIndex = 2
Top = 1035
Width = 1020
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "邮政编码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 120
TabIndex = 1
Top = 210
Width = 1395
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
For i = 0 To 4
text1(i).FontSize = "12" '设置文本字体大小
Next i
End Sub
Private Sub Form_Activate()
text1(0).SetFocus
End Sub
Private Sub text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then '在文本中回车自动移到下一个文本
Select Case Index
Case 0
text1(1).SetFocus
Case 1
text1(2).SetFocus
Case 2
text1(3).SetFocus
Case 3
text1(4).SetFocus
End Select
End If
End Sub
Private Sub Command1_Click()
Printer.Height = 3000 '设置打印信封高度
Printer.Width = 11300 '设置打印信封宽度
Printer.FontSize = 13
Printer.CurrentX = 300
Printer.CurrentY = 550
Printer.Print text1(0).Text
Printer.CurrentX = 500
Printer.CurrentY = 1000
Printer.Print text1(1).Text
Printer.CurrentX = 3000
Printer.CurrentY = 1500
Printer.Print text1(2).Text
Printer.CurrentX = 2000
Printer.CurrentY = 2000
Printer.Print text1(3).Text
Printer.CurrentX = 4000
Printer.CurrentY = 2000
Printer.Print text1(5).Text
Printer.EndDoc
End Sub
Private Sub Command2_Click()
End
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?