【VB开源代码栏目提醒】:网学会员VB开源代码为您提供FMINVOICE.frm参考,解决您在FMINVOICE.frm学习中工作中的难题,参考学习。
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form FMINVOICE
Caption = "Form1"
ClientHeight = 4785
ClientLeft = 60
ClientTop = 345
ClientWidth = 4800
LinkTopic = "Form1"
ScaleHeight = 4785
ScaleWidth = 4800
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command6
Caption = "打印机切纸"
Height = 500
Left = 3360
TabIndex = 18
Top = 3480
Width = 1100
End
Begin VB.CommandButton Command5
Caption = "打印机跳页"
Height = 500
Left = 2280
TabIndex = 17
Top = 3480
Width = 1100
End
Begin VB.CommandButton Command4
Caption = "打印机跳行"
Height = 500
Left = 1200
TabIndex = 16
Top = 3480
Width = 1100
End
Begin VB.CommandButton Command3
Caption = "打开钱柜"
Height = 500
Left = 120
TabIndex = 14
Top = 3480
Width = 1100
End
Begin VB.TextBox TB_TEXT
Height = 375
Left = 960
TabIndex = 13
Text = "This is a test"
Top = 3000
Width = 2055
End
Begin VB.CommandButton Command1
Caption = "测试打印文字"
Height = 375
Left = 3120
TabIndex = 12
Top = 3000
Width = 1440
End
Begin VB.Frame Frame4
Caption = "钱柜连接口"
Height = 1335
Left = 120
TabIndex = 7
Top = 1560
Width = 1335
Begin VB.OptionButton CB_PORT
Caption = "COM4"
Height = 255
Index = 3
Left = 120
TabIndex = 11
Top = 960
Width = 1000
End
Begin VB.OptionButton CB_PORT
Caption = "COM3"
Height = 255
Index = 2
Left = 120
TabIndex = 10
Top = 720
Width = 1000
End
Begin VB.OptionButton CB_PORT
Caption = "COM2"
Height = 255
Index = 1
Left = 120
TabIndex = 9
Top = 480
Value = -1 'True
Width = 1000
End
Begin
VB.OptionButton CB_PORT
Caption = $"FMINVOICE.frx":0000
Height = 255
Index = 0
Left = 120
TabIndex = 8
Top = 240
Width = 1000
End
End
Begin VB.CommandButton Command2
Caption = "关闭窗口"
Height = 615
Left = 960
TabIndex = 6
Top = 4080
Width = 3615
End
Begin VB.Frame Frame1
Caption = "发票机连接口"
Height = 1335
Left = 120
TabIndex = 1
Top = 120
Width = 1335
Begin VB.OptionButton OB_PORT
Caption = $"FMINVOICE.frx":0009
Height = 255
Index = 0
Left = 120
TabIndex = 5
Top = 240
Width = 1000
End
Begin VB.OptionButton OB_PORT
Caption = "COM2"
Height = 255
Index = 1
Left = 120
TabIndex = 4
Top = 480
Value = -1 'True
Width = 1000
End
Begin VB.OptionButton OB_PORT
Caption = "COM3"
Height = 255
Index = 2
Left = 120
TabIndex = 3
Top = 720
Width = 1000
End
Begin VB.OptionButton OB_PORT
Caption = "COM4"
Height = 255
Index = 3
Left = 120
TabIndex = 2
Top = 960
Width = 1000
End
End
Begin VB.TextBox TB_MEMO
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2775
Left = 1560
MultiLine = -1 'True
TabIndex = 0
Text = "FMINVOICE.frx":0012
Top = 120
Width = 3015
End
Begin MSCommLib.MSComm MSComm1
Left = 120
Top = 4080
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
CommPort = 2
DTREnable = -1 'True
End
Begin VB.Label Label11
Caption = "打印文字"
Height = 255
Left = 120
TabIndex = 15
Top = 3060
Width = 1005
End
End
Attribute VB_Name = "FMINVOICE"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim STR As String
CPORT = 1
If OB_PORT(0).Value = True Then CPORT = 1
If OB_PORT(1).Value = True Then CPORT = 2
If OB_PORT(2).Value = True Then CPORT = 3
If OB_PORT(3).Value = True Then CPORT = 4
MSComm1.CommPort = CPORT
With MSComm1
.PortOpen = True
.Handshaking = comRTS
.Handshaking = comNone
.Output = Chr$(27) + "@"
.Output = Chr$(27) + "z" + Chr$(1)
.Output = Chr$(27) + "d" + Chr$(4)
.Output = TB_TEXT.Text & Chr$(13) & Chr$(10)
.PortOpen = False
End With
STR = ""
STR = STR & Chr$(27) + "@"
STR = STR & Chr$(27) + "z" + Chr$(1)
STR = STR & Chr$(27) + "d" + Chr$(4)
STR = STR & TB_TEXT.Text & Chr$(13) & Chr$(10)
TB_MEMO.Text = STR & vbNewLine
End Sub
Private Sub Command3_Click()
Dim STR As String
CPORT = 1
If CB_PORT(0).Value = True Then CPORT = 1
If CB_PORT(1).Value = True Then CPORT = 2
If CB_PORT(2).Value = True Then CPORT = 3
If CB_PORT(3).Value = True Then CPORT = 4
MSComm1.CommPort = CPORT
With MSComm1
.PortOpen = True
.Handshaking = comRTS
.Handshaking = comNone
.Output = Chr$(27) + "@"
.Output = Chr$(27) + "z" + Chr$(1)
.Output = Chr$(27) + "d" + Chr$(4)
.Output = Chr(27) & "p0" & Chr(50) & Chr(250)
.PortOpen = False
End With
STR = ""
STR = STR & Chr$(27) + "@"
STR = STR & Chr$(27) + "z" + Chr$(1)
STR = STR & Chr$(27) + "d" + Chr$(4)
STR = STR & Chr(27) & "p0" & Chr(50) & Chr(250)
TB_MEMO.Text = STR & vbNewLine
End Sub
Private Sub Command4_Click()
Dim STR As String
CPORT = 1
If OB_PORT(0).Value = True Then CPORT = 1
If OB_PORT(1).Value = True Then CPORT = 2
If OB_PORT(2).Value = True Then CPOR