我做的围棋软件

我做的围棋软件

 

一直对围棋比较着迷,虽然水平感觉比较差,但每晚都要下几把过过瘾。前些天没事琢磨着怎么搞出新的下法,让象我一样喜欢围棋的菜鸟们多一点乐趣。因以前下过暗象棋,就是用一半棋盘轮流将象棋翻过来再根据大小厮杀,这个就比较讲机会了。如果围棋也这么下,因为棋盘大变化多,除了增加了随机性,也需要一些判断的。考虑再三觉得应该做一个这样的软件,因为围棋正反都一样,没办法用暗的,只能用软件来解决,顺便练一下逐渐生疏的VB。当时没学计算机专业真是我人生一大憾事,真是悔不当初啊。

 

和电脑对弈的围棋软件太难了,我只需要做两个人对下的程序就可以了。最开始的想法是怎么画棋盘和棋子,除了黑白棋还要加一个中色的。正好电脑里装了两款围棋软件,有现成的棋盘和棋子,看着比较不错。但后来试着做一个中色的围棋,怎么都不成功那种渐变的白或黑色要换成其它的颜色,好像不是很容易(也可能我PS水平不够吧)。后来就想着干脆重新做了,也在网上查到了这样的资料,用PS做围棋子,很容易的样子。于是我回家如法炮制,试了几次,终于弄出了我要的黑白子和黄色的中子,26x26象素的。素材问题解决了。

 

接下来是编程了。按照惯例,做个界面、菜单,都很容易。开始下棋时先选择先后手、着棋时间和双方名字,然后载入围棋棋盘,上面铺满黄色棋子。轮流翻棋,中间如围住另一方的子则提掉,提掉子的地方可以继续下子。剩下的就和一般围棋一样了,根据围空大小判定胜负。

 

铺黄子的时候试了好久,本来倾向用Bitblt语句,还做了一个掩模,后来发现用TransparentBlt也很方便。只是放在棋盘上的子边缘有很明显的黑边,后来在PS里改了下基本满意了。然后是判断下的棋和围住的棋哪些是死棋,死棋如何去掉。感觉没有合适的VB语句,于是采用本办法复制棋盘下棋子的地方(共10个图形,包括4个角4个边界,中间和三三处),如果要去掉棋子,用复制的空白棋盘覆盖掉就可以了。后来试了一下还不错嘿嘿。

 

接下来还有加上声音,读秒等,太麻烦的我就不想弄了。但要做成一个软件需要有保存和调入功能,这个是我接下来的重点。希望做好了能和大家分享。

 

‘以下为窗体的程序

Private Sub fAn_Click()
FrmSelect.Show
End Sub

Private Sub fExit_Click()
Unload Me
End

End Sub

Private Sub Form_Load()

CurX = 15
CurY = 14
picWid = 26
picHgt = 26
iCurrent = 1  '1 stands for white and 2 stands for black
FrmMain.AutoRedraw = True
PicBoard.AutoRedraw = True
For i = 0 To 9
PicOrig(i).AutoRedraw = True
Next i
Picture1.AutoRedraw = True
Picture2.AutoRedraw = True
Timer1.Interval = 1000
Me.Left = Screen.Width / 2 - Me.Width / 2
Me.Top = Screen.Height / 2 - Me.Height / 2
sSave = Space(255)
'»ñµÃϵͳ·¾¶
Ret = GetWindowsDirectory(sSave, 255)
'È¥µôûÓõĿմ®(chr(0))
sSave = Left$(sSave, Ret) & "/cursors/harrow.cur"

aRow = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S")
For i = 0 To 9
PicOrig(i).ScaleHeight = 26
PicOrig(i).ScaleWidth = 26
Next i

BitBlt PicOrig(0).hDC, 0, 0, 26, 26, PicBoard.hDC, 15, 14, SRCCOPY
BitBlt PicOrig(1).hDC, 0, 0, 26, 26, PicBoard.hDC, 15 + 9 * 28, 14, SRCCOPY
BitBlt PicOrig(2).hDC, 0, 0, 26, 26, PicBoard.hDC, 15 + 18 * 28, 14, SRCCOPY
BitBlt PicOrig(3).hDC, 0, 0, 26, 26, PicBoard.hDC, 15, 14 + 9 * 28, SRCCOPY
BitBlt PicOrig(4).hDC, 0, 0, 26, 26, PicBoard.hDC, 15 + 9 * 28, 14 + 9 * 28, SRCCOPY
BitBlt PicOrig(5).hDC, 0, 0, 26, 26, PicBoard.hDC, 15 + 18 * 28, 14 + 9 * 28, SRCCOPY
BitBlt PicOrig(6).hDC, 0, 0, 26, 26, PicBoard.hDC, 15, 14 + 18 * 28, SRCCOPY
BitBlt PicOrig(7).hDC, 0, 0, 26, 26, PicBoard.hDC, 15 + 9 * 28, 14 + 18 * 28, SRCCOPY
BitBlt PicOrig(8).hDC, 0, 0, 26, 26, PicBoard.hDC, 15 + 18 * 28, 14 + 18 * 28, SRCCOPY
BitBlt PicOrig(9).hDC, 0, 0, 26, 26, PicBoard.hDC, 15 + 28, 14 + 2 * 28, SRCCOPY

'»­Í¼


End Sub

Private Sub Form_Unload(Cancel As Integer)
 
End
End Sub

Private Sub hGu_Click()

frmAbout.Show

End Sub

Private Sub hIn_Click()
frmIntro.Show
End Sub

 

Private Sub PicBoard_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)

A = Round((x - 28) / 28 + 1)
B = Round((y - 28) / 28 + 1)
If A > 0 And A <= 19 And B > 0 And B <= 19 And (x - 28 * A) ^ 2 + (y - 28 * B) ^ 2 < 169 Then
   If iStatus(A, B) = 0 Or iStatus(A, B) = 3 And Dir(sSave) <> "" Then 'change cursor
    
     PicBoard.MousePointer = 99
     PicBoard.MouseIcon = LoadPicture(sSave)

   Else  'change cursor back
     PicBoard.MousePointer = 0
   End If '

Else 'change cursor back

PicBoard.MousePointer = 0

End If

End Sub

Private Sub PicBoard_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
A = Round((x - 28) / 28 + 1)
B = Round((y - 28) / 28 + 1)
If A > 0 And A <= 19 And B > 0 And B <= 19 And (x - 28 * A) ^ 2 + (y - 28 * B) ^ 2 < 169 Then
   If iStatus(A, B) = 0 Then
        If isPutable(A, B, iCurrent) Then 'Can put chess in the position
          If iCurrent = 1 Then  'now it is white's turn
          TransparentBlt PicBoard.hDC, CurX + 28 * (A - 1), CurY + 28 * (B - 1), picWid, picHgt, PicWhite.hDC, 0, 0, 26, 26, RGB(0, 0, 0)
           iStatus(A, B) = 1
          'call calChess(a,b,icurrent)  'calculate and remove the dead chess&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
          If iStatus(A - 1, B) = 2 Then
             Call RemoveChess(A - 1, B, 2)
          End If
          If iStatus(A + 1, B) = 2 Then
             Call RemoveChess(A + 1, B, 2)
          End If
          If iStatus(A, B - 1) = 2 Then
             Call RemoveChess(A, B - 1, 2)
          End If
          If iStatus(A, B + 1) = 2 Then
             Call RemoveChess(A, B + 1, 2)
          End If
         
          Call RemoveChess(A, B, iCurrent)
          iCurrent = 2
          TimerPlay1.Enabled = False
          TimerPlay2.Enabled = True
         
          ElseIf iCurrent = 2 Then  'now it's black's turn
          TransparentBlt PicBoard.hDC, CurX + 28 * (A - 1), CurY + 28 * (B - 1), picWid, picHgt, PicBlack.hDC, 0, 0, 26, 26, RGB(0, 0, 0)
          iStatus(A, B) = 2
          If iStatus(A - 1, B) = 1 Then
             Call RemoveChess(A - 1, B, 2)
          End If
          If iStatus(A + 1, B) = 1 Then
             Call RemoveChess(A + 1, B, 2)
          End If
          If iStatus(A, B - 1) = 1 Then
             Call RemoveChess(A, B - 1, 2)
          End If
          If iStatus(A, B + 1) = 1 Then
             Call RemoveChess(A, B + 1, 2)
          End If
          'call calChess(a,b,icurrent)  'calculate and remove the dead chess&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
          Call RemoveChess(A, B, iCurrent)
          iCurrent = 1
          TimerPlay2.Enabled = False
          TimerPlay1.Enabled = True
          End If
         End If
          PicBoard.Refresh
         
         
   ElseIf iStatus(A, B) = 3 Then  'change yellow to black or white color
          If iBlackWhite(A, B) = 1 Then  'white
          TransparentBlt PicBoard.hDC, CurX + 28 * (A - 1), CurY + 28 * (B - 1), picWid, picHgt, PicWhite.hDC, 0, 0, 26, 26, RGB(0, 0, 0)
          PicBoard.Refresh
          iStatus(A, B) = 1
          Else   'black
          TransparentBlt PicBoard.hDC, CurX + 28 * (A - 1), CurY + 28 * (B - 1), picWid, picHgt, PicBlack.hDC, 0, 0, 26, 26, RGB(0, 0, 0)
          PicBoard.Refresh
          iStatus(A, B) = 2
          End If
         
          If iStatus(A - 1, B) = 3 - iBlackWhite(A, B) Then
             Call RemoveChess(A - 1, B, 3 - iBlackWhite(A, B))
          End If
          If iStatus(A + 1, B) = 3 - iBlackWhite(A, B) Then
             Call RemoveChess(A + 1, B, 3 - iBlackWhite(A, B))
          End If
          If iStatus(A, B - 1) = 3 - iBlackWhite(A, B) Then
             Call RemoveChess(A, B - 1, 3 - iBlackWhite(A, B))
          End If
          If iStatus(A, B + 1) = 3 - iBlackWhite(A, B) Then
             Call RemoveChess(A, B + 1, 3 - iBlackWhite(A, B))
          End If
          'call calChess(a,b,icurrent)  'calculate and remove the dead chess&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
          Call RemoveChess(A, B, iBlackWhite(A, B))
          If iCurrent = 1 Then
          iTemp = iBlackWhite(A, B)
          iCurrent = 2
          TimerPlay1.Enabled = False
          TimerPlay2.Enabled = True
          Else
          If iTemp <> iBlackWhite(A, B) Then  'decide who is white or black the first player is iTemp
               If iTemp = 1 Then  'first player is white chess
                  TransparentBlt Picture1.hDC, 0, 0, picWid, picHgt, PicWhite.hDC, 0, 0, 26, 26, RGB(0, 0, 0)
                  TransparentBlt Picture2.hDC, 0, 0, picWid, picHgt, PicBlack.hDC, 0, 0, 26, 26, RGB(0, 0, 0)
               Else          'first player is Black chess
                  TransparentBlt Picture1.hDC, 0, 0, picWid, picHgt, PicBlack.hDC, 0, 0, 26, 26, RGB(0, 0, 0)
                  TransparentBlt Picture2.hDC, 0, 0, picWid, picHgt, PicWhite.hDC, 0, 0, 26, 26, RGB(0, 0, 0)
               End If
          End If
          iCurrent = 1 'calculate the time
          TimerPlay2.Enabled = False
          TimerPlay1.Enabled = True
          End If
   End If
   'put sign on the current chess@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   PlaySound App.Path & "/put.wav", CLng(0), SND_ASYNC Or SND_FILENAME
  
Else

End If
'playsound()

End Sub

Private Sub Timer1_Timer()
ReDim iBlackWhite(21, 21)
ReDim iStatus(21, 21)
iTime1 = 0
iTime2 = 0
 

For i = 0 To 18
   For j = 0 To 18
   'draw yellow chess in board
   
    TransparentBlt PicBoard.hDC, CurX + 28 * i, CurY + 28 * j, picWid, picHgt, PicYellow.hDC, 0, 0, 26, 26, RGB(0, 0, 0)
    iStatus(i + 1, j + 1) = 3

   
   'Fill black/white chess randomly in assey
   Randomize
   iBlackWhite(i + 1, j + 1) = Round(Rnd + 1)
   
   Next j
Next i
Timer1.Enabled = False


For i = 0 To 18
With PicBoard
.CurrentX = 25 + i * 28
.CurrentY = 12 + 19 * 28
.ForeColor = RGB(0, 0, 255)
End With
 
PicBoard.Print aRow(i)
Next i
For i = 0 To 18
With PicBoard
.CurrentX = -3
.CurrentY = 21 + i * 28
.ForeColor = RGB(0, 0, 255)
End With
PicBoard.Print i + 1
Next i
Label1(0).Caption = sPlayer1
Label1(1).Caption = sPlayer2
TransparentBlt Picture1.hDC, 0, 0, picWid, picHgt, PicYellow.hDC, 0, 0, 26, 26, RGB(0, 0, 0)
TransparentBlt Picture2.hDC, 0, 0, picWid, picHgt, PicYellow.hDC, 0, 0, 26, 26, RGB(0, 0, 0)
Label1(0).Visible = True
Label1(1).Visible = True
LabelPlayer1.Visible = True
LabelPlayer2.Visible = True
Picture1.Visible = True
Picture2.Visible = True

TimerPlay1.Enabled = True
PicBoard.Visible = True

End Sub


Private Sub TimerPlay1_Timer()
   iTime1 = iTime1 + 1  'count on second base
   iHour = Format((iTime1 / 3600), "00")
   iMinute = Format(((iTime1 - (iTime1 / 3600) * 3600) / 60), "00")
   iSecond = (Format((iTime1 Mod 60), "00"))
  
   LabelPlayer1.Caption = "ÓÃʱ:" & Chr(13) & iHour & ":" & iMinute & ":" & iSecond
   

End Sub

Private Sub TimerPlay2_Timer()
   iTime2 = iTime2 + 1  'count on second base
 
   iHour = Format((iTime2 / 3600), "00")
   iMinute = Format(((iTime2 - (iTime2 / 3600) * 3600) / 60), "00")
   iSecond = Format((iTime2 Mod 60), "00")
   LabelPlayer2.Caption = "ÓÃʱ:" & Chr(13) & iHour & ":" & iMinute & ":" & iSecond
End Sub


’以下为模块的程序

 

Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, _
ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Public Declare Function PlaySound Lib "winmm.dll" _
    Alias "PlaySoundA" (ByVallpszName As String, _
    ByValhModule As Long, ByValdwFlags As Long) _
    As Long
Public Declare Function TransparentBlt Lib "msimg32.dll" _
     (ByVal hdcDest As Long, _
     ByVal nXOriginDest As Long, _
     ByVal nYOriginDest As Long, _
     ByVal nWidthDest As Long, _
     ByVal nHeightDest As Long, _
     ByVal hdcSrc As Long, _
     ByVal nXOriginSrc As Long, _
     ByVal nYOriginSrc As Long, _
     ByVal nWidthSrc As Long, _
     ByVal nHeightSrc As Long, _
     ByVal crTransparent As Long) As Long
    
Public Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public sSave As String
Public Ret As Long
 
    
Public Const SRCCOPY = &HCC0020
Public Const SRCAND = &H8800C6
Public Const MERGEPAINT = &HBB0226
Public Const SRCPAINT = &HEE0086
Public Const SRCINVERT = &H660046
Public Const SND_ASYNC = 1
Public Const SND_FILENAME = &H20000
 
Public picWid As Integer
Public picHgt As Integer
Public CurX As Integer
Public CurY As Integer
Public A As Integer
Public B As Integer
Public iBlackWhite() As Integer 'initial chess randimized
Public iCurrent As Integer  '1 for player1 and 2 for player2
Public iChecked() As Integer  'purpose to check dead chess or not
Public iPassed() As Integer
Public iRemoveQty As Integer
Public iTemp As Integer  'whether white or black

Public sPlayer1 As String
Public sPlayer2 As String
Public iTime1 As Long  'time spent on player1
Public iTime2 As Long 'time spent on player2
Public iHour As String
Public iMinute As String
Public iSecond As String
Public aRow As Variant
Public xx As Long
Public yy As Long
Public xxx As Long
Public yyy As Long

Public iTimeLimit As Long
Public sFirst As Integer 'who to start first 1&2
Option Explicit
Public iStatus() As Integer '0 for blank, 1for black, 2 for white, 3 for yellow,

Function isPutable(x, y, i) As Boolean  ' return true if putable and false if not putable.
ReDim iChecked(21, 21)
ReDim iPassed(21, 21)
Dim m
Dim n
xx = x
yy = y
iRemoveQty = 1
    For m = 1 To 19
    For n = 1 To 19
      iChecked(m, n) = 0
      iPassed(m, n) = 0
    Next n
    Next m
Do While True
      
          If iStatus(xx - 1, yy) = 0 Or iStatus(xx + 1, yy) = 0 Or iStatus(xx, yy - 1) = 0 Or iStatus(xx, yy + 1) = 0 Then
              isPutable = True
              Exit Do
          ElseIf iStatus(xx - 1, yy) = 3 Or iStatus(xx + 1, yy) = 3 Or iStatus(xx, yy - 1) = 3 Or iStatus(xx, yy + 1) = 3 Then
              isPutable = True
              Exit Do
             
          ElseIf iStatus(xx - 1, yy) = i And iChecked(xx - 1, yy) <> 1 Then
              iChecked(xx, yy) = 1
              xx = xx - 1
              iRemoveQty = iRemoveQty + 1
          ElseIf iStatus(xx + 1, yy) = i And iChecked(xx + 1, yy) <> 1 Then
              iChecked(xx, yy) = 1
              xx = xx + 1
              iRemoveQty = iRemoveQty + 1
          ElseIf iStatus(xx, yy - 1) = i And iChecked(xx, yy - 1) <> 1 Then
              iChecked(xx, yy) = 1
              yy = yy - 1
              iRemoveQty = iRemoveQty + 1
          ElseIf iStatus(xx, yy + 1) = i And iChecked(xx, yy + 1) <> 1 Then
              iChecked(xx, yy) = 1
              yy = yy + 1
              iRemoveQty = iRemoveQty + 1
          ElseIf iStatus(xx - 1, yy) = i And iChecked(xx - 1, yy) And iPassed(xx - 1, yy) <> 1 Then
              iChecked(xx, yy) = 1
              iPassed(xx - 1, yy) = 1
              xx = xx - 1
             
          ElseIf iStatus(xx + 1, yy) = i And iChecked(xx + 1, yy) And iPassed(xx + 1, yy) <> 1 Then
              iChecked(xx, yy) = 1
              iPassed(xx + 1, yy) = 1
              xx = xx + 1
              
          ElseIf iStatus(xx, yy - 1) = i And iChecked(xx, yy - 1) And iPassed(xx, yy - 1) <> 1 Then
              iChecked(xx, yy) = 1
              iPassed(xx, yy - 1) = 1
              yy = yy - 1
              
          ElseIf iStatus(xx, yy + 1) = i And iChecked(xx, yy + 1) And iPassed(xx, yy + 1) <> 1 Then
              iChecked(xx, yy) = 1
              iPassed(xx, yy + 1) = 1
              yy = yy + 1
              
             
          Else ' surrounded with opponent chess
             
              isPutable = False
              Exit Do
          End If

Loop


End Function

Function RemoveChess(x, y, i) 'when put this chess, whether others will be removed or not?
    ReDim iChecked(21, 21)
    ReDim iPassed(21, 21)
    Dim m
    Dim n
   
    'On Error GoTo 0
    xxx = x
    yyy = y
    If isPutable(xxx, yyy, i) Then
   
   
    Else   'self need be removed
       For m = 1 To 19
       For n = 1 To 19
          iChecked(m, n) = 0
          iPassed(m, n) = 0
       Next n
       Next m
       iChecked(xxx, yyy) = 1
       Call DeleteChess(xxx, yyy)
       iRemoveQty = iRemoveQty - 1
       Do While iRemoveQty > 0
          If iStatus(xxx - 1, yyy) = i And iChecked(xxx - 1, yyy) <> 1 Then
              xxx = xxx - 1
              Call DeleteChess(xxx, yyy)
              iRemoveQty = iRemoveQty - 1
              iChecked(xxx, yyy) = 1
              iStatus(xxx, yyy) = 0
          ElseIf iStatus(xxx + 1, yyy) = i And iChecked(xxx + 1, yyy) <> 1 Then
              xxx = xxx + 1
              Call DeleteChess(xxx, yyy)
              iRemoveQty = iRemoveQty - 1
              iChecked(xxx, yyy) = 1
              iStatus(xxx, yyy) = 0
              
          ElseIf iStatus(xxx, yyy - 1) = i And iChecked(xxx, yyy - 1) <> 1 Then
              yyy = yyy - 1
              Call DeleteChess(xxx, yyy)
              iRemoveQty = iRemoveQty - 1
              iChecked(xxx, yyy) = 1
              iStatus(xxx, yyy) = 0
              
          ElseIf iStatus(xxx, yyy + 1) = i And iChecked(xxx, yyy + 1) <> 1 Then
              yyy = yyy + 1
              Call DeleteChess(xxx, yyy)
              iRemoveQty = iRemoveQty - 1
              iChecked(xxx, yyy) = 1
              iStatus(xxx, yyy) = 0
              
          ElseIf iChecked(xxx - 1, yyy) = 1 And iPassed(xxx - 1, yyy) <> 1 Then
              xxx = xxx - 1
              iPassed(xxx, yyy) = 1
          ElseIf iChecked(xxx + 1, yyy) = 1 And iPassed(xxx + 1, yyy) <> 1 Then
              xxx = xxx + 1
              iPassed(xxx, yyy) = 1
          ElseIf iChecked(xxx, yyy - 1) = 1 And iPassed(xxx, yyy - 1) <> 1 Then
              yyy = yyy - 1
              iPassed(xxx, yyy) = 1
          ElseIf iChecked(xxx, yyy + 1) = 1 And iPassed(xxx, yyy + 1) <> 1 Then
              yyy = yyy + 1
              iPassed(xxx, yyy) = 1
          End If
         
       Loop
   
   
    End If
  
 
End Function


Function DeleteChess(x, y)
   If x = 1 And y = 1 Then
    BitBlt FrmMain.PicBoard.hDC, 15, 14, 26, 26, FrmMain.PicOrig(0).hDC, 0, 0, SRCCOPY
   ElseIf x < 19 And y = 1 Then
    BitBlt FrmMain.PicBoard.hDC, 15 + (x - 1) * 28, 14, 26, 26, FrmMain.PicOrig(1).hDC, 0, 0, SRCCOPY
   ElseIf x = 19 And y = 1 Then
    BitBlt FrmMain.PicBoard.hDC, 15 + (x - 1) * 28, 14, 26, 26, FrmMain.PicOrig(2).hDC, 0, 0, SRCCOPY
   
   ElseIf x = 1 And y > 1 And y < 19 Then
    BitBlt FrmMain.PicBoard.hDC, 15, 14 + (y - 1) * 28, 26, 26, FrmMain.PicOrig(3).hDC, 0, 0, SRCCOPY
   ElseIf x = 19 And y > 1 And y < 19 Then
    BitBlt FrmMain.PicBoard.hDC, 15 + (x - 1) * 28, 14 + (y - 1) * 28, 26, 26, FrmMain.PicOrig(5).hDC, 0, 0, SRCCOPY
   ElseIf x = 1 And y = 19 Then
    BitBlt FrmMain.PicBoard.hDC, 15, 14 + (y - 1) * 28, 26, 26, FrmMain.PicOrig(6).hDC, 0, 0, SRCCOPY
   ElseIf (x = 4 And y = 4) Or (x = 10 And y = 4) Or (x = 16 And y = 4) Or (x = 4 And y = 10) Or (x = 10 And y = 10) Or (x = 16 And y = 10) _
       Or (x = 4 And y = 16) Or (x = 10 And y = 16) Or (x = 16 And y = 16) Then
    BitBlt FrmMain.PicBoard.hDC, 15 + (x - 1) * 28, 14 + (y - 1) * 28, 26, 26, FrmMain.PicOrig(4).hDC, 0, 0, SRCCOPY
   ElseIf x > 1 And x < 19 And y = 19 Then
    BitBlt FrmMain.PicBoard.hDC, 15 + (x - 1) * 28, 14 + (y - 1) * 28, 26, 26, FrmMain.PicOrig(7).hDC, 0, 0, SRCCOPY

   ElseIf x = 19 And y = 19 Then
    BitBlt FrmMain.PicBoard.hDC, 15 + (x - 1) * 28, 14 + (y - 1) * 28, 26, 26, FrmMain.PicOrig(8).hDC, 0, 0, SRCCOPY
   Else
    BitBlt FrmMain.PicBoard.hDC, 15 + (x - 1) * 28, 14 + (y - 1) * 28, 26, 26, FrmMain.PicOrig(9).hDC, 0, 0, SRCCOPY
   End If
   iStatus(x, y) = 0
   FrmMain.PicBoard.Refresh
End Function


 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值