473,802 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MouseEventHandl er != this.controlnam e.MouseEnter ?

I am trying to figure out how to use MouseEnter or MouseLeave events, and be
able to use the EventArgs to determine where the mouse cursor is. To my
great confusion, the MouseEnter and MouseLeave events are not
MouseEventHandl ers.

so am I missing something, or is my .NET install messed up? it seems to me
that an event caused by a mouse being somewhere on the screen, should have
MouseEventArgs attached to it, not System.EventArg s.

but then again, maybe I am expecting too much, that the .NET framework be
logical. anyone have any advice on how to get this done, or should I just
assume events arent going to help me here and figure out how to determine
the location of the cursor manually?
thanks
NICK
Nov 16 '05 #1
1 2664
Nick,

You are right, the MouseEnter and the MouseLeave events do not have
position information associated with them. However, you can get the current
cursor position by calling the static Position property onthe Cursor class.
This will tell you where the cursor is in relation to the screen.

Because it is in screen coordinates, you have to convert them to local
coordinates (in relation to the control). In order to do this, you can pass
the coordinates to the PointToClient method on the Control class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"SeaNICK" <ed*******@hotm ail.com> wrote in message
news:Ok******** *****@TK2MSFTNG P11.phx.gbl...
I am trying to figure out how to use MouseEnter or MouseLeave events, and
be able to use the EventArgs to determine where the mouse cursor is. To my
great confusion, the MouseEnter and MouseLeave events are not
MouseEventHand lers.

so am I missing something, or is my .NET install messed up? it seems to me
that an event caused by a mouse being somewhere on the screen, should have
MouseEventArgs attached to it, not System.EventArg s.

but then again, maybe I am expecting too much, that the .NET framework be
logical. anyone have any advice on how to get this done, or should I just
assume events arent going to help me here and figure out how to determine
the location of the cursor manually?
thanks
NICK

Nov 16 '05 #2

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

Similar topics

1
2516
by: Matt | last post by:
If we use GET protocol, we can use either Request("controlname") or Request.QueryString("controlname") to get the data entered by the user. But if we use POST protocol, we MUST use Request("controlname"), and Request.QueryString("controlname") won't work. I think Request("controlname") means Request.Form("controlname"), which is used for POST protocol. But seems like it works for GET protocol too. Here's the code I tested. <%
8
1271
by: Robert Megee | last post by:
I'd like to be able to make a web controls such as a textbox either visible or not-visible by using the name of the textbox in a string and using that string in some command. sort of like: string str1;
4
4804
by: Arif | last post by:
how to display combobox contents(the same function that occurs when Mouse is pressed on a combobox but) on MouseEnter/MouseHover events? arif.
4
1214
by: Paul | last post by:
Hi, noticed high activity on this newsgroup as the last few posts I have made have not received a response. Anyhow I noticed that with a .NET web application when the webform opens if the user hits the tab key it goes to the address bar at the top of the browser. I would like it to go to a control and have set the tab index to 0 and 1 but still goes to the address bar. Thanks. -- Paul G Software engineer.
0
1083
by: Charles Law | last post by:
Is there a way to get the MouseEnter event to fire for a user control that inherits from UpDownBase? The event is hidden, and does not fire when the mouse enters the control. TIA Charles
5
1915
by: Just Me | last post by:
Given a button name Btn_5 and Index=5 I want to do something like dim zz as string = Btn_??Index??.Text or given an array of buttons, do:
1
8504
by: Mark Reed | last post by:
Hi All, I'm having a problem with the following code. I've read quite a lot of old posts regarding the issue but none seem to affer a solution. The scenario is. I have a bound form which contains a couple of memo fields. I need to keep some sort of log as to when each update of the memo field occurs so I have locked bot the memo fields on the main form. To edit them, the user double clicks the ememo field which then opens an unbound...
4
3818
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've a MouseEnter event on a dataGrid, and I want to know, if the mouse entered column no. 0 or column no. 1 . How can it be done? Thanks, Gidi.
8
10389
by: shaielinna | last post by:
<? ob_start(); session_start(); require('../includes/inc.php'); require('../includes/settings.php'); include("../includes/dbconnect.php");?> <?php // requires the class require "../includes/class.datepicker.php";
0
9699
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
9561
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,...
1
10281
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10058
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7597
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
6835
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3789
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
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.