sslivins
Nov 5th, 1999, 03:27 AM
I'm making a checkers game and when I drag a peice off the board and drop it, it disappears. Is there a simple way to prevent this such as monitoring the mouse icon and when it changes to a NoDrop icon then I can replace that peice?
Aaron Young
Nov 5th, 1999, 03:49 AM
You could limit the Area in which the Cursor can move, eg.
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Private tRect As RECT
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
tRect.Left = ScaleX(Left, vbTwips, vbPixels)
tRect.Top = ScaleY(Top, vbTwips, vbPixels)
tRect.Right = ScaleX(Left + Width, vbTwips, vbPixels)
tRect.Bottom = ScaleY(Top + Height, vbTwips, vbPixels)
Call ClipCursor(tRect)
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then Call ClipCursor(ByVal 0&)
End Sub
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net