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

📄 net5-2.frm

📁 一个具有聊天功能的游戏程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "欢迎光临"
   ClientHeight    =   3195
   ClientLeft      =   45
   ClientTop       =   270
   ClientWidth     =   4530
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3195
   ScaleWidth      =   4530
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command2 
      Caption         =   "结束"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3240
      TabIndex        =   9
      Top             =   600
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3240
      TabIndex        =   8
      Top             =   120
      Width           =   1095
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1440
      TabIndex        =   7
      Top             =   2760
      Width           =   3015
   End
   Begin VB.Frame Frame1 
      Caption         =   "游戏的玩法"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1335
      Left            =   120
      TabIndex        =   3
      Top             =   1200
      Width           =   4335
      Begin VB.OptionButton Option2 
         Caption         =   "我要加入一个连线棋局"
         BeginProperty Font 
            Name            =   "MS Serif"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   5
         Top             =   840
         Width           =   2775
      End
      Begin VB.OptionButton Option1 
         Caption         =   "我要当主机"
         BeginProperty Font 
            Name            =   "MS Serif"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   4
         Top             =   360
         Value           =   -1  'True
         Width           =   3015
      End
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1200
      TabIndex        =   2
      Top             =   600
      Width           =   1575
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "你的主机IP"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   120
      TabIndex        =   6
      Top             =   2760
      Width           =   1155
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "你的名字"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   120
      TabIndex        =   1
      Top             =   600
      Width           =   960
   End
   Begin VB.Label Label1 
      Caption         =   "欢迎光临网络五子棋"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   2175
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Server = 1 Then
   Form1.Winsock1.LocalPort = 5238
   Form1.Winsock1.Listen
   Form1.Label1(1).Caption = "黑子:" + Text1.Text
   Form1.Label1(3).Caption = ""
   Form1.Label2.Caption = "等待加入中"
Else
   Form1.Winsock1.RemoteHost = Text2.Text
   Form1.Winsock1.RemotePort = 5238
   Form1.Winsock1.LocalPort = 0
   Form1.Winsock1.Connect
   Form1.Label1(1).Caption = ""
   Form1.Label1(3).Caption = "白子:" + Text1.Text
   Form1.Label2.Caption = "正在连线到主机"
End If
Form1.Label1(2).Caption = "战绩:" + Str(Win(1)) + "胜" + Str(Lost(1)) + "败"
Form1.Label1(4).Caption = "战绩:" + Str(Win(2)) + "胜" + Str(Lost(2)) + "败"
Form1.Show
Form1.Pic1.Enabled = False
Form1.Enabled = True
Form2.Hide
Unload Form2
ResetGame
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
Form1.Enabled = False
CloseCom
Text2.Text = Form1.Winsock1.LocalIP
Server = 1
Win(1) = 0
Win(2) = 0
Lost(1) = 0
Lost(2) = 0
End Sub

Private Sub Option1_Click()
Label3.Caption = "你的主机IP"
Text2.Text = Form1.Winsock1.LocalIP
Server = 1
End Sub

Private Sub Option2_Click()
Label3.Caption = "连线主机IP"
Text2.Text = "0.0.0.0"
Server = 2
End Sub

⌨️ 快捷键说明

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