Dragging graphics with mouse
Posted on 2003-11-19
I've created a scrollview in which graphic boxes, lines, charts, etc. are drawn on the screen. I've been drawing them by overriding the OnDraw of the view and passing the pDC to various object classes I've created to draw the objects.
Now I'm trying to add some functionality by allowing the user to click and drag the objects. I'm thinking that redrawing every time the mouse moves (using the windows message) will cause major flicker and is a bad idea. I need the objects (and a mouse popup) to follow the cursor.
My question is, what would be the best technique to allow users to drag drawn objects? Should I just invalidate a portion of the window and re-draw?
(note: point value higher since I need the solution quickly. probably not very difficult)