|
-
November 26th, 2007, 11:15 PM
#2
Re: Image dragging
Do you already have code to display a bitmap on the screen (since you seem to be making a chess program)?
I have never made a user-defined mouse cursor, but would instead tackle the problem by tracking the mouse movements and blitting the bitmap at the cursor position.
Here are the generalities:
For non-MFC, you want to pay attention to the WM_MOUSEMOVE, WM_LBUTTONDOWN, and WM_LBUTTONUP messages. When the button goes down you'll save state information, blit the bitmap while the mouse moves, and return to the non-clicked state when you see the up message.
One catch with this approach...
If the user clicks the mouse in your window, moves the mouse outside your window, and then releases the button, you will not get the button up message because the mouse is no longer over your window, so whatever is underneath will get the message. To fix this, you want to also handle the WM_NCLBUTTONUP message (the NC stands for non-client) or more probably the WM_MOUSELEAVE message.
Does this help?
GeoRanger
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|