查看單個文章
舊 2005-07-07, 04:42 PM   #1
魔術王子
版區管理員
 
魔術王子 的頭像
榮譽勳章
UID - 115097
在線等級: 級別:42 | 在線時長:1986小時 | 升級還需:35小時級別:42 | 在線時長:1986小時 | 升級還需:35小時
註冊日期: 2004-01-13
住址: 魔術學園
文章: 2951
精華: 0
現金: 14792 金幣
資產: 2678422 金幣
預設 篡改-井字遊戲+猜數字遊戲(可網路對戰)

可能最近忙得腦筋有點秀逗了
竟然將猜數字遊戲加入之前轉貼的[井字遊戲]
同樣是在網路上對戰
不過有點陽春,有興趣的人可以修改看看
OnLine3_LT.frm的內容(負責網路連線)
語法:
VERSION 5.00
Begin VB.Form frmLinkType 
   BorderStyle     =   1  '單線固定
   Caption         =   "網路連線設定"
   ClientHeight    =   3075
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5400
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3075
   ScaleWidth      =   5400
   StartUpPosition =   3  '系統預設值
   Begin VB.TextBox Text1 
      Height          =   270
      Left            =   1320
      TabIndex        =   10
      Top             =   1200
      Visible         =   0   'False
      Width           =   975
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      ItemData        =   "OnLine3_LT.frx":0000
      Left            =   240
      List            =   "OnLine3_LT.frx":000A
      Style           =   2  '單純下拉式
      TabIndex        =   9
      Top             =   720
      Width           =   2055
   End
   Begin VB.TextBox txtIP 
      BeginProperty Font 
         Name            =   "新細明體"
         Size            =   12
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3000
      TabIndex        =   7
      Text            =   "0.0.0.0"
      Top             =   1560
      Width           =   1935
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "結束"
      BeginProperty Font 
         Name            =   "新細明體"
         Size            =   12
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3120
      TabIndex        =   6
      Top             =   2280
      Width           =   1215
   End
   Begin VB.CommandButton cmdConnect 
      Caption         =   "確定"
      BeginProperty Font 
         Name            =   "新細明體"
         Size            =   12
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1080
      TabIndex        =   5
      Top             =   2280
      Width           =   1215
   End
   Begin VB.OptionButton optConnect 
      Caption         =   "加入連結。"
      BeginProperty Font 
         Name            =   "新細明體"
         Size            =   12
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   1
      Left            =   3120
      TabIndex        =   4
      Top             =   840
      Width           =   1575
   End
   Begin VB.OptionButton optConnect 
      Caption         =   "等待連結。"
      BeginProperty Font 
         Name            =   "新細明體"
         Size            =   12
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   0
      Left            =   3120
      TabIndex        =   3
      Top             =   480
      Width           =   1575
   End
   Begin VB.Frame Frame1 
      Caption         =   "選擇連結方式"
      ForeColor       =   &H00FF0000&
      Height          =   1095
      Left            =   2760
      TabIndex        =   2
      Top             =   240
      Width           =   2175
   End
   Begin VB.TextBox txtName 
      BeginProperty Font 
         Name            =   "新細明體"
         Size            =   12
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   960
      TabIndex        =   1
      Top             =   120
      Width           =   1335
   End
   Begin VB.Label Label2 
      Caption         =   "您的數字:"
      Height          =   255
      Left            =   240
      TabIndex        =   11
      Top             =   1200
      Visible         =   0   'False
      Width           =   975
   End
   Begin VB.Label lblIPreport 
      AutoSize        =   -1  'True
      Caption         =   "你的主機 IP為:"
      BeginProperty Font 
         Name            =   "新細明體"
         Size            =   12
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   240
      Left            =   240
      TabIndex        =   8
      Top             =   1680
      Width           =   1695
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "暱稱:"
      BeginProperty Font 
         Name            =   "新細明體"
         Size            =   12
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   720
   End
End
Attribute VB_Name = "frmLinkType"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdConnect_Click()
    If (Combo1.ListIndex = 0) Then
        Load frmOX
        frmOX.Show
        frmOX.sName = txtName.Text
        If bIfServer = False Then frmOX.sServerIP = txtIP.Text
        frmOX.subConnect
        Me.Hide
    Else
        Load frmAB
        frmAB.Show
        frmAB.sNum = Text1.Text
        frmAB.sName = txtName.Text
        If bIfServer = False Then frmAB.sServerIP = txtIP.Text
        frmAB.subConnect
        Me.Hide
    End If
End Sub

Private Sub cmdExit_Click()
    End
End Sub

Private Sub Combo1_Click()
    If (Combo1.ListIndex = 1) Then
        Label2.Visible = True
        Text1.Visible = True
    Else
        Label2.Visible = False
        Text1.Visible = False
    End If
End Sub

Private Sub Form_Load()
    
    Me.Show
    bIfServer = True
    optConnect(0).Value = True
    optConnect(1).Value = False
    lblIPreport = "你的主機 IP 為:" & frmOX.Winsock1.LocalIP
    txtIP.Visible = False
    Combo1.ListIndex = 0
End Sub

Private Sub Form_Unload(Cancel As Integer)
    End
End Sub

Private Sub optConnect_Click(Index As Integer)
    If Index = 0 Then
        bIfServer = True '要當伺服端
        lblIPreport = "你的主機 IP 為:" & frmOX.Winsock1.LocalIP
        txtIP.Visible = False
    Else
        bIfServer = False '要當用戶端
        lblIPreport = "請輸入欲連結的主機 IP :"
        txtIP.Visible = True
    End If
End Sub
魔術王子 目前離線  
送花文章: 1523, 收花文章: 1553 篇, 收花: 3892 次
回覆時引用此帖