'呵呵,简单到不能再简单了,
'如果who需要源代码,我可以发给她,留下Email地址'有一人先启动wzq.exe登入,点选先入,然后等待另外一人运行wzq.exe
'填写先入一人的IP地址和接受端口号,然后连接,
'
'需要保证双方不选取相同颜色的棋子,需要实现商量好。'然后可以下棋,没有判赢程序
'刘小斌 2002年4月23日 [email protected] X1 As Integer
Dim Y1 As Integer
Dim X2 As Integer
Dim Y2 As Integer
Dim Step As Integer
Dim Waiting As Boolean
Private Sub Check1_Click()
    Winsock1.LocalPort = port
    Winsock1.Listen
End SubPrivate Sub Command1_Click()
    Winsock1.RemoteHost = Ip
    Winsock1.RemotePort = port
    Winsock1.Connect
End SubPrivate Sub Form_Load()
    Step = 200
    X1 = 400
    Y1 = 600
    X2 = 400 + Step * 24
    Y2 = 600 + Step * 24
    Check2.BackColor = vbYellow
End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Waiting = False Then
        QiZhi X, Y, True
    End If
End SubPrivate Sub Form_Paint()
    For i = 0 To 24
        Me.Line (X1, Y1 + Step * i)-(X2, Y1 + Step * i)
        Me.Line (X1 + Step * i, Y1)-(X1 + Step * i, Y2)
    Next
End SubPrivate Function QiZhi(X, Y, SendData As Boolean)
    Dim color As Long
    Dim xx As Integer
    Dim yy As Integer
    xx = (((X - X1 - 100) \ (Step \ 2)) \ 2 + 1) * Step + X1
    yy = (((Y - Y1 - 100) \ (Step \ 2)) \ 2 + 1) * Step + Y1
    If Check2.Value = 1 Then
        If SendData Then
            color = vbBlue
        Else
            color = vbYellow
        End If
    Else
        If SendData Then
            color = vbYellow
        Else
            color = vbBlue
        End If
    End If
    For i = 0 To 49
        Me.Circle (xx, yy), i * 2, color
    Next
    If SendData Then
        Winsock1.SendData Str(xx) & "|" & Str(yy)
        Waiting = True
        Label3 = "轮到对方下棋"
    Else
        Waiting = False
        Label3 = "轮到你了,赶快"
    End If
End Function
                Private Sub Check2_Click()
    If Check2.Value = 1 Then
        Check2.BackColor = vbBlue
    Else
        Check2.BackColor = vbYellow
    End If
End SubPrivate Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
    If Winsock1.State <> sckClosed Then Winsock1.Close
    Winsock1.Accept requestID
End SubPrivate Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    Dim xx As Integer
    Dim yy As Integer
    Dim dd As String
    Winsock1.GetData dd, vbString, bytesTotal
    Debug.Print dd
    a = Split(dd, "|")
    QiZhi a(0), a(1), False
End Sub