By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,864 Members | 1,293 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,864 IT Pros & Developers. It's quick & easy.

Mouse events

P: n/a
I'm trying to use the MouseEnter event but it isn't behaving how I'd like it
to. The problem is that if you hold down the mouse button over another
control (or the form) and then enter the control, the event isn't triggered.

Is there any way to make the MouseEnter event occur in this situation?
Nov 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Barguast" <It*****************@Email.com> wrote in message
news:83**********************************@microsof t.com...
I'm trying to use the MouseEnter event but it isn't behaving how I'd like
it
to. The problem is that if you hold down the mouse button over another
control (or the form) and then enter the control, the event isn't
triggered.
When you hold down the mouse on a control/window that window "captures" the
mouse to ensure that it will receive the MouseUp event from Windows. This
means that the mouse is not available to the other controls.
Is there any way to make the MouseEnter event occur in this situation?


Probably, but it'd likely involve some pretty nasty Win32 code. Are you sure
that this is so important?
Nov 17 '05 #2

P: n/a
The event that will be triggered is Dragging because the button is pressed.

cheers
Salva

"Barguast" wrote:
I'm trying to use the MouseEnter event but it isn't behaving how I'd like it
to. The problem is that if you hold down the mouse button over another
control (or the form) and then enter the control, the event isn't triggered.

Is there any way to make the MouseEnter event occur in this situation?

Nov 17 '05 #3

P: n/a
> Probably, but it'd likely involve some pretty nasty Win32 code. Are you sure
that this is so important?


It is pretty important. I've made a 'table' control that itself contains a
number of 'cell' controls. I'm trying to enable the ability to select a block
of cells like you would in a spreadsheet (hold the mouse button down over one
cell, release it over another cell, and select all the cells inbetween). I
was hoping to use the MouseEnter event of a cell to detect when the block
selection had changed but, as I said, the event won't trigger when the mouse
button is pressed down :(
Nov 17 '05 #4

P: n/a
None of the Drag events are triggering either. But then again, I wouldn't
have thought the Dragging events were supposed to trigger in this specific
situation...

"Salvador" wrote:
The event that will be triggered is Dragging because the button is pressed.

cheers
Salva

"Barguast" wrote:
I'm trying to use the MouseEnter event but it isn't behaving how I'd like it
to. The problem is that if you hold down the mouse button over another
control (or the form) and then enter the control, the event isn't triggered.

Is there any way to make the MouseEnter event occur in this situation?

Nov 17 '05 #5

P: n/a
"Barguast" <It*****************@Email.com> wrote in message
news:5A**********************************@microsof t.com...
Probably, but it'd likely involve some pretty nasty Win32 code. Are you
sure
that this is so important?


It is pretty important. I've made a 'table' control that itself contains a
number of 'cell' controls. I'm trying to enable the ability to select a
block
of cells like you would in a spreadsheet (hold the mouse button down over
one
cell, release it over another cell, and select all the cells inbetween). I
was hoping to use the MouseEnter event of a cell to detect when the block
selection had changed but, as I said, the event won't trigger when the
mouse
button is pressed down :(


An easier option would be to have the table draw the cells, rather than have
them as separate controls.

Anyway, if you decide you have to follow your current route, I can't help
you much more than indicate the direction of your research:
- Have a look at ReleaseCapture and SetCapture. Calling ReleaseCapture when
the mouse exits the cell will allow other cells to received it's events.
However it'll stop the original control receiving the MouseUp event. You can
probably pass this message on to the original window.
- Have a look at the WM_LBUTTONUP message.

What I *think* you might have to do is track that a MouseDown occurs, then
call ReleaseCapture on the starting control. Then, once the button is
actually released, pass the WM_LBUTTONUP message to the original control.
Note that it might be possible to do without this step. However, if not, you
might need to trap the WM_LBUTTONUP messages, since the .NET control your
mouse is over might not pass them through if they're not matched with a
corresponding WM_LBUTTONDOWN message.
Nov 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.