⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmnetconnect.frm

📁 想加入你们
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmNetConnect 
   Caption         =   "连线设定视窗"
   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         =   "我要加入连线主机"
      Height          =   252
      Left            =   360
      TabIndex        =   5
      Top             =   1920
      Width           =   2400
   End
   Begin VB.OptionButton optServer 
      Caption         =   "我要当主机"
      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         =   "如果你知道对方的电脑名称,也可以直接打对方的电脑名称喔!(如果在同一网域的话)"
      Height          =   612
      Left            =   360
      TabIndex        =   6
      Top             =   120
      Width           =   2892
   End
   Begin VB.Label lblConnectType 
      Alignment       =   1  '靠右对齐
      Caption         =   "本机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 = "向主机要求连线中..."
     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 = "无法取得本机电脑名称!如果你要当连线主机,请对方以IP连线,否则请至控制台-网路,查看识别资料是否设定正确"
Else
   lblComputerName.Caption = "本机电脑名称:" & MyComputerName
End If

optServer.Value = True
End Sub

Private Sub optClient_Click()
ConnectType = CONNECT_CLIENT
lblConnectType.Caption = "连线主机IP"
txtIP.Text = MyComputerName
End Sub

Private Sub optServer_Click()
ConnectType = CONNECT_SERVER
lblConnectType.Caption = "本机IP"
txtIP.Text = frmGame.wskConnect.LocalIP
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -