Sri Harsha Chilakapati
Sri Harsha Chilakapati

Reputation: 11940

Dragging in C# without dropping

I am making a map editor for my games. I had already managed to add an object to the map when the user clicks on the map. It would be handy for me to add objects in a path the user clicks mouse and drags (like the pencil in mspaint). What events do I need to register to give that effect?

Thanks for any ideas.

Upvotes: 0

Views: 55

Answers (1)

Guy P
Guy P

Reputation: 1423

Here is the main idea :

use MouseUp() MouseDown() and MouseMove() .

Set some bool to 0 - tell you if you are Dragging.

When (mouse Down) and (flag==0) then START_DRAGGING. Then mouse move knows if you are dragging by flag==1.

When (mouse UP) and (flag == 1) you know youv'e just stopped dragging, so set flag to 0 again.

Upvotes: 2

Related Questions