?? frmclient.frm
字號:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form frmClient
BorderStyle = 1 'Fixed Single
Caption = "聊天程序_客戶端"
ClientHeight = 5085
ClientLeft = 45
ClientTop = 330
ClientWidth = 5115
Icon = "frmclient.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5085
ScaleWidth = 5115
StartUpPosition = 3 '窗口缺省
Begin MSComDlg.CommonDialog CommonDialog1
Left = 2640
Top = 3840
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton cmdQuit
Caption = "斷開"
Height = 375
Left = 3825
TabIndex = 11
Top = 4200
Width = 1230
End
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 375
Left = 3825
TabIndex = 10
Top = 4680
Width = 1230
End
Begin VB.CommandButton cmdLogin
Caption = "登錄"
Height = 375
Left = 3810
TabIndex = 9
Top = 705
Width = 1230
End
Begin RichTextLib.RichTextBox rtbIn
Height = 2295
Left = 75
TabIndex = 8
Top = 1560
Width = 4980
_ExtentX = 8784
_ExtentY = 4048
_Version = 393217
BackColor = 16777215
Enabled = -1 'True
ReadOnly = -1 'True
ScrollBars = 2
TextRTF = $"frmclient.frx":030A
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 660
Left = 0
TabIndex = 5
Top = 0
Width = 5115
_ExtentX = 9022
_ExtentY = 1164
ButtonWidth = 1032
ButtonHeight = 1005
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 4
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Login"
ImageKey = "login"
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Connect"
ImageKey = "connect"
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Save"
ImageKey = "save"
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Quit"
ImageKey = "quit"
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 5520
Top = 3960
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 4
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmclient.frx":0596
Key = "login"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmclient.frx":08B2
Key = "connect"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmclient.frx":0BCE
Key = "save"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmclient.frx":0CE2
Key = "quit"
EndProperty
EndProperty
End
Begin VB.CommandButton cmdConnect
Caption = "連接"
Height = 375
Left = 3810
TabIndex = 4
Top = 1140
Width = 1230
End
Begin VB.TextBox txtPort
BackColor = &H00FFFFFF&
Height = 450
Left = 960
Locked = -1 'True
TabIndex = 3
Top = 1125
Width = 2655
End
Begin VB.TextBox txtHost
BackColor = &H00FFFFFF&
Height = 390
Left = 945
Locked = -1 'True
TabIndex = 2
Top = 720
Width = 2670
End
Begin VB.TextBox txtOut
Height = 855
Left = 90
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 4200
Width = 3675
End
Begin MSWinsockLib.Winsock tcpClient
Left = 3240
Top = 3960
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.Label Label3
BackColor = &H00FF0000&
BackStyle = 0 'Transparent
Caption = "顯示框"
ForeColor = &H00000000&
Height = 375
Left = 165
TabIndex = 7
Top = 1200
Width = 810
End
Begin VB.Label Label2
BackColor = &H00FF0000&
BackStyle = 0 'Transparent
Caption = "輸入框"
ForeColor = &H00000000&
Height = 255
Left = 105
TabIndex = 6
Top = 3960
Width = 1065
End
Begin VB.Label lblName
BackColor = &H00FF0000&
BackStyle = 0 'Transparent
Caption = "客戶端"
ForeColor = &H00000000&
Height = 240
Left = 225
TabIndex = 1
Top = 780
Width = 615
End
End
Attribute VB_Name = "frmClient"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim NewClient As Boolean
Private Sub cmdConnect_Click()
On Error GoTo errhandle:
tcpClient.RemoteHost = txtHost.Text
tcpClient.RemotePort = txtPort.Text
tcpClient.Connect
NewClient = True
Exit Sub
errhandle:
MsgBox Err.Description
End Sub
Private Sub Command1_Click()
End Sub
Private Sub Command2_Click()
End Sub
Private Sub Command3_Click()
End Sub
Private Sub cmdExit_Click()
Unload frmClient
End Sub
Private Sub cmdLogin_Click()
Load frmClientLogIn
frmClientLogIn.Show
End Sub
Private Sub cmdQuit_Click()
On Error GoTo errhandle:
tcpClient.SendData "^q" & lblName.Caption & CStr(Now())
Exit Sub
errhandle:
MsgBox Err.Description
End Sub
Private Sub Form_Load()
'txtHost.Text = "166.111.162.179"
'txtPort.Text = "5000"
Me.cmdConnect.Enabled = False
Me.cmdQuit.Enabled = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
FrmWebBroswer.Show
End Sub
Private Sub tcpClient_Connect()
txtOut.Locked = False
tcpClient.SendData "/" + lblName.Caption
End Sub
Private Sub tcpClient_DataArrival(ByVal bytesTotal As Long)
Dim sData As String
If NewClient Then
MsgBox "has connected successfully"
NewClient = False
End If
tcpClient.GetData sData
rtbIn.Text = rtbIn.Text + sData
rtbIn.SelStart = Len(sData)
If sData = "you can quit." Then
tcpClient.Close
End If
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case Is = "Connect"
cmdConnect_Click
Case Is = "Login"
cmdLogin_Click
Case Is = "Quit"
cmdQuit_Click
Case Is = "Save"
' cmdSave_click
End Select
End Sub
Private Sub txtOut_KeyUp(KeyCode As Integer, Shift As Integer)
On Error GoTo errhandle:
If KeyCode = 13 Then
tcpClient.SendData lblName.Caption + ":" + txtOut.Text
'rtbIn.Text = rtbIn.Text + txtOut.Text
txtOut.Text = ""
End If
Exit Sub
errhandle:
MsgBox Err.Description
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -