📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "显示屏VB样例程序"
ClientHeight = 2475
ClientLeft = 1140
ClientTop = 1275
ClientWidth = 4530
LinkTopic = "Form1"
ScaleHeight = 2475
ScaleWidth = 4530
Begin VB.TextBox Text1
Height = 375
Left = 2160
TabIndex = 8
Text = "欢迎光临恭王府!"
Top = 600
Width = 2055
End
Begin VB.TextBox Txt
Height = 375
Left = 2160
TabIndex = 7
Text = "欢迎光临"
Top = 120
Width = 2055
End
Begin VB.CommandButton Command6
Caption = "电源状态"
Height = 435
Left = 2760
TabIndex = 6
Top = 1920
Width = 1095
End
Begin VB.CommandButton Command5
Caption = "发送数据"
Height = 435
Left = 2760
TabIndex = 5
Top = 1440
Width = 1095
End
Begin VB.CommandButton Command4
Caption = "关闭电源"
Height = 435
Left = 1560
TabIndex = 4
Top = 1920
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "打开电源"
Height = 435
Left = 360
TabIndex = 3
Top = 1920
Width = 1095
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 1000
Left = 3120
Top = 240
End
Begin VB.CommandButton Command2
Caption = "查询"
Height = 435
Left = 1560
TabIndex = 2
Top = 1440
Width = 1095
End
Begin VB.PictureBox Picture1
AutoSize = -1 'True
BorderStyle = 0 'None
FillStyle = 0 'Solid
Height = 960
Left = 120
Picture = "Form1.frx":0000
ScaleHeight = 64
ScaleMode = 3 'Pixel
ScaleWidth = 128
TabIndex = 1
Top = 0
Width = 1920
End
Begin VB.CommandButton Command1
Caption = "打开串口"
Height = 435
Left = 360
TabIndex = 0
Top = 1440
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const Address = 0
Const ComPort = 1 '用COM4作为通讯端口
Dim dev As Long
Private Sub Command1_Click()
Dim param As TDeviceParam
'下面是串口传输方式代码
param.devType = DEVICE_TYPE_COM
param.ComPort = 1
param.speed = SBR_57600
param.FlowCon = 0
'下面是网络传输方式代码
'Param.devType = DEV_UDP
'Param.locPort = 8888 '本地端口号可任意指定,一般来说80为HTTP,23为FTP等等,指定大于1024的基本没有问题
'Param.rmtPort = 6666 '远程端口必须为6666
dev = LED_Open(param, 1, Me.hWnd, WM_LED_NOTIFY)
If dev = -1 Then
MsgBox ("无法打开指定端口")
Else
Form1.Caption = "打开串口成功"
End If
End Sub
Private Sub Command2_Click()
LED_Query dev, Address, "192.168.1.167", 6666
End Sub
Private Sub Command3_Click()
LED_SetPower dev, Address, "192.168.1.167", 6666, LED_POWER_ON
End Sub
Private Sub Command4_Click()
LED_SetPower dev, Address, "192.168.1.167", 6666, LED_POWER_OFF
End Sub
Private Sub Command5_Click()
Dim ARect As rect
Timer1.Enabled = False
MakeRoot ROOT_PLAY, SCREEN_COLOR '形成发送数据
AddLeaf 10000 '追加一个页面
SetRect ARect, 0, 0, 64, 32
'' AddWindow Picture1.hDC, Picture1.ScaleWidth, ScaleHeight, ARect, 1, 1, 1 '发送一幅图片
AddText "" & Trim(Txt.Text) & " ", ARect, 1, 1, 1, "楷体", 12, RGB(255, 255, 0)
SetRect ARect, 0, 16, 64, 32
'' AddWindow Picture1.hDC, Picture1.ScaleWidth, ScaleHeight, ARect, 1, 1, 1 '发送一幅图片
AddText "" & Trim(Text1.Text) & " ", ARect, 2, 1, 1, "楷体", 9, RGB(0, 255, 255)
Me.Caption = "正在发送数据..."
LED_SendToScreen dev, 255, "192.168.1.167", 6666
End Sub
Private Sub Command6_Click()
LED_GetPower dev, Address, "192.168.1.167", 6666
End Sub
Private Sub Form_Load()
Hook Me.hWnd
'LED_Startup
End Sub
Private Sub Form_unLoad(Cancel As Integer)
LED_Close dev
UnHook Me.hWnd
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -