?? frmnetconnect.frm
字號(hào):
VERSION 5.00
Begin VB.Form frmNetConnect
Caption = "連線設(shè)定視窗"
ClientHeight = 2844
ClientLeft = 1584
ClientTop = 1524
ClientWidth = 3696
LinkTopic = "Form1"
ScaleHeight = 237
ScaleMode = 3 '像素
ScaleWidth = 308
Begin VB.Timer tmrWait
Enabled = 0 'False
Left = 0
Top = 0
End
Begin VB.OptionButton optClient
Caption = "我要加入連線主機(jī)"
Height = 252
Left = 360
TabIndex = 5
Top = 1920
Width = 2400
End
Begin VB.OptionButton optServer
Caption = "我要當(dāng)主機(jī)"
Height = 180
Left = 360
TabIndex = 4
Top = 1680
Width = 2400
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 372
Left = 2040
TabIndex = 3
Top = 2280
Width = 1332
End
Begin VB.CommandButton cmdConnect
Caption = "連線開始!"
Height = 372
Left = 360
TabIndex = 2
Top = 2280
Width = 1332
End
Begin VB.TextBox txtIP
Height = 264
Left = 1560
TabIndex = 1
Top = 840
Width = 1692
End
Begin VB.Label lblComputerName
Height = 372
Left = 360
TabIndex = 7
Top = 1200
Width = 2892
End
Begin VB.Label lblTip
Caption = "如果你知道對(duì)方的電腦名稱,也可以直接打?qū)Ψ降碾娔X名稱喔!(如果在同一網(wǎng)域的話)"
Height = 612
Left = 360
TabIndex = 6
Top = 120
Width = 2892
End
Begin VB.Label lblConnectType
Alignment = 1 '靠右對(duì)齊
Caption = "本機(jī)IP"
Height = 252
Left = 240
TabIndex = 0
Top = 840
Width = 1212
End
End
Attribute VB_Name = "frmNetConnect"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdConnect_Click()
If Trim$(txtIP) = "" Then
MsgBox "沒有填寫IP", vbOKOnly Or vbExclamation, Me.Caption
Exit Sub
End If
With frmGame
Select Case ConnectType
Case CONNECT_SERVER
.wskConnect.LocalPort = 1001
.wskConnect.Listen
.lblMyMessage.Caption = "等待連線中..."
Case CONNECT_CLIENT
.wskConnect.RemoteHost = txtIP
.wskConnect.RemotePort = 1001
.wskConnect.Connect
.lblMyMessage.Caption = "向主機(jī)要求連線中..."
End Select
.GameSetUP.Enabled = False
.NetButter.Enabled = False
.ExitGame.Enabled = False
.AboutNumberGame.Enabled = False
.ConnectClose.Visible = True
.cmdGameStart.Enabled = False
.lblMyMessage.Visible = True
.lblConnectUserMessage.Visible = True
.lblUserName(1).Caption = "敵手"
.lblUserName(2).Caption = MyComputerName
End With
Unload Me
End Sub
Private Sub Form_Load()
Dim x, y
x = (Screen.Width - Me.Width) / 2
y = (Screen.Height - Me.Height) / 2
Me.Move x, y
If MyComputerName = "" Then
lblComputerName.Caption = "無(wú)法取得本機(jī)電腦名稱!如果你要當(dāng)連線主機(jī),請(qǐng)對(duì)方以IP連線,否則請(qǐng)至控制臺(tái)-網(wǎng)路,查看識(shí)別資料是否設(shè)定正確"
Else
lblComputerName.Caption = "本機(jī)電腦名稱:" & MyComputerName
End If
optServer.Value = True
End Sub
Private Sub optClient_Click()
ConnectType = CONNECT_CLIENT
lblConnectType.Caption = "連線主機(jī)IP"
txtIP.Text = MyComputerName
End Sub
Private Sub optServer_Click()
ConnectType = CONNECT_SERVER
lblConnectType.Caption = "本機(jī)IP"
txtIP.Text = frmGame.wskConnect.LocalIP
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -