1
1

Sudoku.bas 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Private Sub Sudoku_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  2. Me.Sudoku.Visible = False
  3. ' 定义九宫格方向上下左右等
  4. Dim pos_x As Variant, pos_y As Variant
  5. pos_x = Array(16, 16, 27, 27, 27, 16, 4, 4, 4, 16)
  6. pos_y = Array(16, 4, 4, 16, 27, 27, 27, 16, 4, 16)
  7. If Abs(X - pos_x(0)) < 4 And Abs(Y - pos_y(0)) < 4 Then
  8. Me.Sudoku.Picture = bmp0.Picture
  9. ElseIf Abs(X - pos_x(1)) < 4 And Abs(Y - pos_y(1)) < 4 Then
  10. Me.Sudoku.Picture = bmp1.Picture
  11. ElseIf Abs(X - pos_x(2)) < 4 And Abs(Y - pos_y(2)) < 4 Then
  12. Me.Sudoku.Picture = bmp2.Picture
  13. ElseIf Abs(X - pos_x(3)) < 4 And Abs(Y - pos_y(3)) < 4 Then
  14. Me.Sudoku.Picture = bmp3.Picture
  15. ElseIf Abs(X - pos_x(4)) < 4 And Abs(Y - pos_y(4)) < 4 Then
  16. Me.Sudoku.Picture = bmp4.Picture
  17. ElseIf Abs(X - pos_x(5)) < 4 And Abs(Y - pos_y(5)) < 4 Then
  18. Me.Sudoku.Picture = bmp5.Picture
  19. ElseIf Abs(X - pos_x(6)) < 4 And Abs(Y - pos_y(6)) < 4 Then
  20. Me.Sudoku.Picture = bmp6.Picture
  21. ElseIf Abs(X - pos_x(7)) < 4 And Abs(Y - pos_y(7)) < 4 Then
  22. Me.Sudoku.Picture = bmp7.Picture
  23. ElseIf Abs(X - pos_x(8)) < 4 And Abs(Y - pos_y(8)) < 4 Then
  24. Me.Sudoku.Picture = bmp8.Picture
  25. End If
  26. Me.Sudoku.Visible = True
  27. End Sub