Dragging the mouse over a control

O

ohadasor

Hello,

I have a control which I need to act in a specific way when the user
drags the mouse on it. Means, that the user should click on the
control's one position, hold the mouse button, move it to another
position on the control, and releases the mouse. It isn't like drag and
drop, when two objects are interacting. Here I have only one control.

Also, I need to when the user also pressed the ctrl key while dragging.

Please help.

Thanks,
Ohad.
 
M

Markus Stoeger

Hello,

I have a control which I need to act in a specific way when the user
drags the mouse on it. Means, that the user should click on the
control's one position, hold the mouse button, move it to another
position on the control, and releases the mouse. It isn't like drag and
drop, when two objects are interacting. Here I have only one control.

Also, I need to when the user also pressed the ctrl key while dragging.

Please help.

When the user clicks on the control you'll get the MouseDown event.
When the user moves the mouse you'll get MouseMove events.
When the user releases the mouse button you'll get the MouseUp event.

You can query the status of the Ctrl key with Control.ModifierKeys oder
use the KeyDown event.

hth,
Max
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top