473,882 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determine the Control under the mouse cursor

How can I determine the control under the mouse cursor when a user
muves the mouse?? For example if the user moves the cursor over a
textbox i would receive the name of that textbox without using the
"MouseMove" event for that textbox.

Thanks

Nov 21 '05 #1
6 8680
"Andrea V.F." <vf******@gmail .com> schrieb:
How can I determine the control under the mouse cursor when a user
muves the mouse?? For example if the user moves the cursor over a
textbox i would receive the name of that textbox without using the
"MouseMove" event for that textbox.


Take a look at the form's 'GetChildAtPoin t' method. You can determine the
current cursor position using 'Cursor.Positio n'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
Your suggestion works if a component is on a Form, but not if the
component is on a Panel (as in my case).

Thanks for help.

Nov 21 '05 #3


Andrea V.F. wrote:
Your suggestion works if a component is on a Form, but not if the
component is on a Panel (as in my case).


If the control returned from Form.GetControl AtPoint is a container
control, then you need to call *its* GetControlAtPoi nt method, and so
on recursively until you end up with a control that isn't a container,
or Nothing, which means you are on a blank part of the container. Make
sure to transform your Point appropriately on the way down.

It might be easier to hook up all your form's controls' MouseMove event
to a single event handler.

--
Larry Lard
Replies to group please

Nov 21 '05 #4
if I call the GetControlAtPoi nt of the panel I receive always Nothing
even if I'm on a control into the panel.

What do you mean with "Make
sure to transform your Point appropriately on the way down."

Nov 21 '05 #5
"Andrea V.F." <vf******@gmail .com> schrieb:
if I call the GetControlAtPoi nt of the panel I receive always Nothing
even if I'm on a control into the panel.

What do you mean with "Make
sure to transform your Point appropriately on the way down."


'Control.PointT oClient' et al. The control's 'GetControlAtPo int' method
expects control coordinates, not screen coordinates.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6


Herfried K. Wagner [MVP] wrote:
"Andrea V.F." <vf******@gmail .com> schrieb:
if I call the GetControlAtPoi nt of the panel I receive always Nothing
even if I'm on a control into the panel.

What do you mean with "Make
sure to transform your Point appropriately on the way down."


'Control.PointT oClient' et al. The control's 'GetControlAtPo int' method
expects control coordinates, not screen coordinates.


I was gonna say that and I had a nice sample ready, but my sample
doesn't work! I have a nice recursive routine that takes screen
coordinates and returns the control in that position - BUT - when do I
call it? Form.MouseMove is no use as it isn't called when not
*directly* on the form; and I think we wanted to avoid hooking to every
MouseMove event?

Confused.

--
Larry Lard
Replies to group please

Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
17318
by: Csaba2000 | last post by:
I have set onmousedown to change the cursor, but this setting is ignored (IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the mouse button is released. On Opera 7.01, the setting seems to be ignored completely, even when I try with window.setTimeout. So my two questions are: (1) Most important: Is there anything I can do so that I don't have to wait for the next mouse event before the cursor gets repainted. (2) Why...
15
10954
by: Tinus | last post by:
Hello all, I've created a custom control that draws a monthly schedule (using the Draw function in C#). Basically it draws 31 boxes and writes the day number in every box. This works great. But I now want to show a different tooltip for every day. For now I found out that I can add a tooltip for the entire custom control
3
7542
by: Blaz Ziherl | last post by:
I have this control that has no MouseEnter or MouseLeave events. How could I find out whether the mouse cursor is over that control or not? Is there an equivalent to the WindowFromPoint API function available in VB.NET? Regards, Blaz Ziherl blaz.ziherl@abraxas.si
2
5028
by: Sam | last post by:
Hi, I can't figure out how to detect when my mouse cursor leaves a panel control. It should not trigger the event (or do anything) when the mouse leave the panel but still is over a control that is contained by the panel. I've done this : Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs) If Cursor.Position.X > Me.Location.X + Me.Width Or Cursor.Position.Y > Me.Location.Y + Me.Height _
3
8920
by: Wayne Wengert | last post by:
In VB.NET is there a way to set the mouse cursor to the Wait cursor that will stay in effect across several forms? For example, I want to set the cursor to the WaitCursor in formA just before it calls formB and FormB may, in turn, call another form. I want the WaitCursor until control is returned to formA where I reset it to Default. (I believe that in VB6 there was the notion of a screen cursor - that is what I want) TIA Wayne
1
3064
by: celoftis | last post by:
BACKGROUND: I have some PPT slides that have been converted to HTM (ensuring that the show slide animations while browsing checkbox is checked). The original HTM slides have custom animations to allow movie (wmv) playback on mouse click. (All animations have been verified to work when viewing slides in ppt.) Further, I have ensured that the converted HTM file(s) contain only relative file paths. SITUATION #1 When I open the converted...
0
2135
by: NonNB | last post by:
Hi I have a user control which the user can "drag" across the screen (I'm not using "real" .NET drag drop - instead a single click flavour, where the control is drawn at the mouse position). Depending on whether the user has "picked up" the control or not, I need the following behaviour 1) When the control is being dragged, the control must not intercept
1
32506
Ericks
by: Ericks | last post by:
This must be a piece of cake and I'm sure it has been addressed somewhere in this forum. I have a form with a control that when clicked on opens another form. So I want the cursor to change to a hand cursor when moving over the control like with a hyperlink, making it easy to spot for the user (I guess you saw this one coming). In Access 2007 I could simply make the control a hyperlink with the "always" attribute, and the hand cursor appears...
0
1577
vekipeki
by: vekipeki | last post by:
Does anyone know if there is a way to set a custom mouse cursor for an ActiveX control in .Net? I am adding some mouse functionality to an existing ActiveX control, and would like to change the cursor shape according to the current state. It's a Windows Forms app, with an ActiveX control wrapped in the (automatically generated) class (derived from AxHost). Although AxHost is derived from Windows.Forms.Control, the public Cursor property does...
0
9931
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9777
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11108
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10725
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7956
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5781
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5978
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.