IfYouSaySo
Well-known member
Ok, still working on my chessboard control, and another issue comes up. When the user clicks on a chesspiece and drags it to a new square, I want to animate that. So what I did is, I made a handler for mouse-down, mouse-up, and mouse-move. On mouse down, I populate what I call a drag-image and put what it's coordinates are at. On mouse-move, I update the drag-image's coordinates and call Invalidate() against the control. And in mouse down I set the image into whatever the destination square I am sitting over and clear out the drag-image. The Paint code just paints the drag-image at whatever location it is currently at. This works...SORT OF. The problem is if I simply call Me.Invalidate() in mouse-move handler, the drawing seems pretty slow. Like if I move a piece very quickly, there is a noticable delay before the piece catches up with the mouse. If I call Me.Invalidate(rect) where rect is the space occupied by the image, it is somewhat better in terms of responsiveness, but now if I move the mouse quickly, the clip rectangle doesn't catch everything to redraw...so you see parts of the image left behind where it was moved over. And yes, I'm using double buffer....
Hope that makes sense. Does anyone have any ideas?
Hope that makes sense. Does anyone have any ideas?