📄 frmclt.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form Frmclt
Caption = "客户端程序"
ClientHeight = 7185
ClientLeft = 60
ClientTop = 645
ClientWidth = 5985
LinkTopic = "Form1"
Picture = "Frmclt.frx":0000
ScaleHeight = 7185
ScaleWidth = 5985
StartUpPosition = 2 '屏幕中心
Begin MSComDlg.CommonDialog CommonDialog1
Left = 120
Top = 6000
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSWinsockLib.Winsock Winsockc
Left = 240
Top = 6720
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.TextBox txtreceive
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3135
Left = 840
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 5
Top = 1560
Width = 4695
End
Begin VB.TextBox txtsend
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1935
Left = 840
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 4
Top = 5040
Width = 4695
End
Begin VB.TextBox txtsip
Height = 375
Left = 1200
TabIndex = 3
Top = 840
Width = 1935
End
Begin VB.TextBox Txtcip
Height = 375
Left = 1200
TabIndex = 2
Top = 240
Width = 1935
End
Begin VB.CommandButton Command2
BackColor = &H00FFC0FF&
Caption = "结束聊天"
Height = 735
Left = 4680
Picture = "Frmclt.frx":BF71
Style = 1 'Graphical
TabIndex = 1
Top = 480
Width = 975
End
Begin VB.CommandButton Command1
BackColor = &H00FFC0C0&
Caption = "连接服务器"
Height = 735
Left = 3480
MaskColor = &H00FFC0C0&
Picture = "Frmclt.frx":C3B3
Style = 1 'Graphical
TabIndex = 0
Top = 480
Width = 1095
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "内容"
BeginProperty Font
Name = "华文新魏"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 255
Left = 120
TabIndex = 9
Top = 4920
Width = 510
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "信息"
BeginProperty Font
Name = "华文新魏"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 255
Left = 120
TabIndex = 8
Top = 1560
Width = 510
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "服务器IP:"
BeginProperty Font
Name = "华文新魏"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 255
Left = 0
TabIndex = 7
Top = 960
Width = 1260
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "本机IP:"
BeginProperty Font
Name = "华文新魏"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 255
Left = 240
TabIndex = 6
Top = 240
Width = 1005
End
Begin VB.Menu co
Caption = "颜色"
Begin VB.Menu get
Caption = "接收的信息"
End
Begin VB.Menu send
Caption = "发送的信息"
End
End
End
Attribute VB_Name = "Frmclt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Winsockc.RemoteHost = txtsip.Text
Winsockc.Connect
txtsend.SetFocus
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
txtreceive.Text = ""
txtsend.Text = ""
Winsockc.RemotePort = 10001
Txtcip.Text = Winsockc.LocalIP
End Sub
Private Sub get_Click()
CommonDialog1.ShowColor
txtreceive.ForeColor = CommonDialog1.Color
End Sub
Private Sub send_Click()
CommonDialog1.ShowColor
txtsend.ForeColor = CommonDialog1.Color
End Sub
Private Sub txtsend_Change()
If Winsockc.RemoteHost <> "" Then
Winsockc.SendData Txtcip.Text & ": " & txtsend.Text
Else
MsgBox "请先进行连接再发送信息!"
End If
End Sub
Private Sub Winsockc_Connect()
MsgBox "连接服务器成功!您可以聊天喽!", vbInformation
End Sub
Private Sub Winsockc_DataArrival(ByVal bytesTotal As Long)
Dim mystr As String
Winsockc.GetData mystr
txtreceive.Text = mystr
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -