473,395 Members | 1,666 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Mouse events

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
5 6307
"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
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
> 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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: John Champaign | last post by:
Hi all, I'm working on an educational applet for a child with special needs. He's got a bit of a trick to make my life more difficult... To interact with the applet he needs to click on...
0
by: Stephen Williams | last post by:
I am migrating a VB 6 PictureBox control to VB.NET. In VB 6, this control modified its border style during the mouse down and up events to provide user feedback that it was selected. Once...
1
by: Jean-Gael GRICOURT | last post by:
I am trying to capture mouse events when entering and leaving a DIV layer. This test code works fine with IE 6.0 and Opera 7.21 but fails with Mozilla/Netscape. The strange thing is that the mouse...
3
by: red | last post by:
mouse events when the mouse is on a "child control" hi everyone; my problem: I have a userControl in this usercontrol, I have a child control (a button) when the mouse moves over the...
5
by: Bill Henning | last post by:
Does anyone know a good method of preventing keyboard and mouse events from interrupting processing? My situation is: 1) I need to track and handle all key and mouse events 2) I need to perform...
3
by: Rick Strahl [MVP] | last post by:
I'm working on an app that's using the WebBrowser control. I got the control working fine, hooking to the document object. But I've run into a major issue with hooking the Document events....
3
by: Charles Law | last post by:
In a user control, is it possible to replace the default mouse events with my own? In particular, I want the consumer of my control to get MouseMove events when the mouse is over my control, so...
2
by: bretth | last post by:
In a VB.Net Windows Forms application, I have a user control that handles mouse events. Another section of code programmatically adds a label to the control. I would like label to ignore all...
5
by: Adeel | last post by:
Hi group! I'm trying to learn C# on my own... I'd appreciate it very much if someone can help me out here. I have a basic form without any controls on it... I want to catch mouse clicks (both...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.