当PICTURE中的点与一数组对应,通过数组来划画和画棋子,算法很简单的

解决方案 »

  1.   

    Dim TableWidth  As Long
    Private Sub Picture1_Click()Dim i As Long
    TableWidth = Picture1.ScaleWidth / 20
    Picture1.Height = TableWidth * 20 + 100
    For i = 1 To 10
         Picture1.Line (TableWidth, i * TableWidth)-(10 * TableWidth, i * TableWidth)
         Picture1.Line (i * TableWidth, TableWidth)-(i * TableWidth, 10 * TableWidth)
         Next i
    End Sub
      

  2.   

    以下是完整代码:
    Dim TableWidth  As LongPrivate Sub Form_Load()
    Picture1.AutoRedraw = True
    Picture1.FillStyle = 0
    Dim i As Long
    TableWidth = Picture1.ScaleWidth / 20
    Picture1.Height = TableWidth * 20 + 100
    For i = 1 To 10
         Picture1.Line (TableWidth, i * TableWidth)-(10 * TableWidth, i * TableWidth)
         Picture1.Line (i * TableWidth, TableWidth)-(i * TableWidth, 10 * TableWidth)
         Next i
    End SubPrivate Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Static red As Integer
    red = 1 - red
    If (X > TableWidth And Y > TableWidth And Y < 10 * TableWidth And X < 10 * TableWidth) Then
           If red = 1 Then
                  Picture1.FillColor = RGB(0, 0, 0)
                Else
                  Picture1.FillColor = RGB(255, 255, 255)
                  End If
           Picture1.Circle (CInt(X / TableWidth) * TableWidth, CInt(Y / TableWidth) * TableWidth), TableWidth / 2
       End If
    End Sub
      

  3.   

    我编过类似程序,虽然没完成(算法太难了),但棋盘和下子功能已完成,需要的话给我发信:[email protected]
      

  4.   

    该代码已实现棋盘,和出子功能(只是在图形上),你可以试用:Dim TableWidth  As LongPrivate Sub Form_Load()
    Picture1.AutoRedraw = True
    Picture1.FillStyle = 0
    Dim i As Long
    TableWidth = Picture1.ScaleWidth / 20
    Picture1.Height = TableWidth * 20 + 100
    For i = 1 To 10
         Picture1.Line (TableWidth, i * TableWidth)-(10 * TableWidth, i * TableWidth)
         Picture1.Line (i * TableWidth, TableWidth)-(i * TableWidth, 10 * TableWidth)
         Next i
    End SubPrivate Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Static red As Integer
    red = 1 - red
    If (X > TableWidth And Y > TableWidth And Y < 10 * TableWidth And X < 10 * TableWidth) Then
           If red = 1 Then
                  Picture1.FillColor = RGB(0, 0, 0)
                Else
                  Picture1.FillColor = RGB(255, 255, 255)
                  End If
           Picture1.Circle (CInt(X / TableWidth) * TableWidth, CInt(Y / TableWidth) * TableWidth), TableWidth / 2
       End If
    End Sub
      

  5.   

    to caichunmao(转瞬之间) 
    谢谢你,我下网后试试,有问题再找你。
    to fst(二百五) 
    好的,过会我发信给你。
      

  6.   

    http://www.csdn.net/soft/openfile.asp?kind=1&id=94
    CSDN上有也!!!!!