📄 form1.frm
字号:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
BorderStyle = 0 'None
Caption = "Form1"
ClientHeight = 5925
ClientLeft = 4470
ClientTop = 1380
ClientWidth = 5565
ControlBox = 0 'False
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "Form1.frx":17002
ScaleHeight = 5925
ScaleWidth = 5565
ShowInTaskbar = 0 'False
Begin VB.Timer Timer1
Interval = 50
Left = 2040
Top = 2400
End
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 10
Left = 2520
Top = 2400
End
Begin VB.TextBox NameText
Height = 285
Left = 4320
ScrollBars = 3 'Both
TabIndex = 2
Top = 2280
Width = 975
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 3480
Top = 2280
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSCommLib.MSComm MSComm1
Left = 3000
Top = 2280
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = 0 'False
End
Begin RichTextLib.RichTextBox rtfSend
Height = 1335
Left = 120
TabIndex = 1
Top = 4320
Width = 3975
_ExtentX = 7011
_ExtentY = 2355
_Version = 393217
Enabled = -1 'True
ScrollBars = 3
AutoVerbMenu = -1 'True
TextRTF = $"Form1.frx":84E5E
End
Begin RichTextLib.RichTextBox rtfReceive
Height = 3255
Left = 120
TabIndex = 0
Top = 720
Width = 3975
_ExtentX = 7011
_ExtentY = 5741
_Version = 393217
Enabled = -1 'True
ReadOnly = -1 'True
ScrollBars = 3
AutoVerbMenu = -1 'True
TextRTF = $"Form1.frx":84EF6
End
Begin VB.Image Image2
Height = 360
Left = 10
Picture = "Form1.frx":84F8E
Top = 20
Width = 420
End
Begin VB.Image Faceimage
Height = 300
Index = 9
Left = 3600
Picture = "Form1.frx":857B0
Top = 3990
Width = 300
End
Begin VB.Image Faceimage
Height = 300
Index = 8
Left = 3240
Picture = "Form1.frx":85D82
Top = 3990
Width = 300
End
Begin VB.Image Faceimage
Height = 285
Index = 7
Left = 2880
Picture = "Form1.frx":86354
Top = 3990
Width = 285
End
Begin VB.Image Faceimage
Height = 300
Index = 6
Left = 2520
Picture = "Form1.frx":8680A
Top = 3990
Width = 300
End
Begin VB.Image Faceimage
Height = 300
Index = 5
Left = 2160
Picture = "Form1.frx":86DDC
Top = 3990
Width = 300
End
Begin VB.Image Faceimage
Height = 300
Index = 4
Left = 1800
Picture = "Form1.frx":873AE
Top = 3990
Width = 300
End
Begin VB.Image Faceimage
Height = 285
Index = 3
Left = 1440
Picture = "Form1.frx":878A0
Top = 3990
Width = 285
End
Begin VB.Image Faceimage
Height = 285
Index = 2
Left = 1080
Picture = "Form1.frx":87E5E
Top = 3990
Width = 285
End
Begin VB.Image Faceimage
Height = 285
Index = 1
Left = 720
Picture = "Form1.frx":8841C
Top = 3990
Width = 285
End
Begin VB.Image Faceimage
Height = 285
Index = 0
Left = 360
Picture = "Form1.frx":888D2
Top = 3990
Width = 285
End
Begin VB.Image Image1
Height = 525
Left = 4320
Picture = "Form1.frx":88D88
Top = 4680
Width = 1080
End
Begin VB.Image SetOnTop
Height = 330
Left = 4320
Picture = "Form1.frx":8AB54
Top = 5280
Width = 1065
End
Begin VB.Image Send
Height = 330
Left = 4320
Picture = "Form1.frx":8B330
Top = 4320
Width = 1065
End
Begin VB.Image SetName
Height = 330
Left = 4320
Picture = "Form1.frx":8BB0C
Top = 2880
Width = 1065
End
Begin VB.Image JoinChat
Height = 330
Left = 4320
Picture = "Form1.frx":8C2E8
Top = 1680
Width = 1065
End
Begin VB.Image NewChat
Height = 330
Left = 4320
Picture = "Form1.frx":8CAC4
Top = 1080
Width = 1065
End
Begin VB.Image SetCOM
Height = 330
Left = 4320
Picture = "Form1.frx":8D2A0
Stretch = -1 'True
Top = 3480
Width = 1065
End
Begin VB.Line Line12
BorderColor = &H00400000&
BorderWidth = 3
X1 = 120
X2 = 4080
Y1 = 710
Y2 = 710
End
Begin VB.Line Line11
BorderColor = &H00400000&
BorderWidth = 3
X1 = 120
X2 = 4080
Y1 = 5660
Y2 = 5660
End
Begin VB.Line Line1
BorderColor = &H00400000&
BorderWidth = 3
X1 = 120
X2 = 4080
Y1 = 4300
Y2 = 4300
End
Begin VB.Line Line10
BorderColor = &H00400000&
BorderWidth = 3
X1 = 110
X2 = 110
Y1 = 5640
Y2 = 720
End
Begin VB.Line Line9
BorderColor = &H00800000&
BorderWidth = 3
X1 = 0
X2 = 0
Y1 = 5880
Y2 = 0
End
Begin VB.Line Line5
BorderColor = &H00400000&
BorderWidth = 3
X1 = 120
X2 = 4080
Y1 = 3975
Y2 = 3975
End
Begin VB.Line Line2
BorderColor = &H00400000&
BorderWidth = 3
X1 = 4095
X2 = 4095
Y1 = 5640
Y2 = 720
End
Begin VB.Image Close
Height = 315
Left = 5160
Picture = "Form1.frx":8DA7C
Top = 45
Width = 300
End
Begin VB.Image Minimize
Height = 300
Left = 4750
Picture = "Form1.frx":8DFAA
Top = 45
Width = 315
End
Begin VB.Line Line8
BorderColor = &H00800000&
BorderWidth = 3
X1 = 5520
X2 = 5520
Y1 = 5860
Y2 = 0
End
Begin VB.Line Line7
BorderColor = &H00800000&
BorderWidth = 3
X1 = 0
X2 = 5520
Y1 = 5880
Y2 = 5880
End
Begin VB.Line Line6
BorderColor = &H00800000&
BorderWidth = 3
X1 = 0
X2 = 0
Y1 = 60
Y2 = 5940
End
Begin VB.Line Line3
BorderColor = &H00800000&
BorderWidth = 3
X1 = 5520
X2 = 0
Y1 = 360
Y2 = 360
End
Begin VB.Image Caption
Height = 360
Left = 0
Picture = "Form1.frx":8E4EC
Top = 0
Width = 5550
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'************************************************
Dim intCommPort As Long '串口号
Dim strCommSettings As String '串口设置
Dim intOutBufferSize As Long '发送缓冲区大小
Dim intInBufferSize As Long '接收缓冲区大小
Dim blnShowFlag As Boolean '显示或隐藏文件传输窗体标志
Dim intColorSet() As Long '用于记录消息显示的格式
Dim intArrayCount As Long '用于记录消息显示的格式
'************************************************
Public mXd, mYd As Integer
Public mXj, mYj As Integer
Public formXd, formYd, formXj, formYj As Long
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_SHOWWINDOW = &H40
Private Declare Function SetWindowPos Lib _
"user32" (ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, ByVal x As Long, _
ByVal y As Long, ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Long
Private Sub Caption_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
'这里是图片(可用在另的控件上)Caption的鼠标按下事件开始拖动.
mXj = mXd * 15 '由鼠标X座标获得鼠标在屏幕Left的数值
formXj = Form1.Left '把窗体form1的Left给formXj
mYj = mYd * 15 '由鼠标Y座标获得鼠标在屏幕Top的数值
formYj = Form1.Top '把窗体form1的 Top给formYj
Timer2.Enabled = True '开始拖动
End Sub
Private Sub Caption_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
'这里是图片(可用在另的控件上)Caption的鼠标抬起事件结束拖动.
Timer2.Enabled = False '停止拖动
End Sub
Private Sub Close_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Form1.Close.Picture = LoadResPicture("CLOSE2", 0)
End Sub
Private Sub Close_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Call CheckCursUp(Form1.Close.Left, Form1.Close.Top, Form1.Close.Width, Form1.Close.Height)
If ButtonUpSign = True Then
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
Call Shell_NotifyIcon(NIM_DELETE, nfIconData)
End
Else
Form1.Close.Picture = LoadResPicture("CLOSE1", 0)
End If
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
rtfReceive.Locked = True
Image2.Picture = LoadResPicture("clearimage", 0)
End Sub
'使本程序的系统托盘图标消失
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call Shell_NotifyIcon(NIM_DELETE, nfIconData)
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim lMsg As Single
lMsg = x / Screen.TwipsPerPixelX
Select Case lMsg
Case WM_LBUTTONUP
'单击左键,显示窗体
ShowWindow Me.hwnd, SW_RESTORE
'下面两句的目的是把窗口显示在窗口最顶层
Me.Show
Me.SetFocus
'' Case WM_RBUTTONUP
'' PopupMenu MenuTray '如果是在系统Tray图标上点右键,则弹出菜单MenuTray
'' Case WM_MOUSEMOVE
'' Case WM_LBUTTONDOWN
'' Case WM_LBUTTONDBLCLK
'' Case WM_RBUTTONDOWN
'' Case WM_RBUTTONDBLCLK
'' Case Else
End Select
End Sub
Private Sub test()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -