|
|
|
Instruction on how to keep the mouse from moving outside client area
Abstract: My term project is a simple chess game. When the user drag a chess piece, that piece is suppose to move with the mouse as it is dragged and I have to report where the piece is dragged to. If the user dragged it to somewhere outside of the client, then I’m lost. One way to get the location outside of client is to “trap the mouse” using SetCapture(). Petzold has a good example on using SetCapture(). But there is no point on catching where the user dropped the piece outside of the client area since it’s not a valid move anyway. The best way is to stop the user from dragging the piece outside of client area. Logon to read this entire article Or sign up for an account FREE! |
||||||||||||||||||||||||||||