I’m using Delphi 5.0
I want to implement a form such that:
When I press the mouse down on the client area and move the cursor, the position of graph in client area will move following the mouse. When mouse button up, graph will stay there. (Just image how we drag the pages in adobe pdf viewer).
The cap problem I have now is don’t know how to trace the movement of mouse cursor on client area.
I know I can use OnMouseMove event to detect the movement of cursor. However, this event only detect the coordinate of cursor after movement(when event is triggered), but not before movement. So I don’t know how to implement the offset of graph (the only idea I have now is to detect how much have been drag on mouse, then apply the offset to graph).
I can use a state variable to record the last coordinate of cursor, but this may course error if the cursor leave client area from left(stop triggering), then enter client arent from right(start triggering).
Can you give me some idea?