473,789 Members | 2,312 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 2663
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
1270
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
1914
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
8503
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
10387
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
9657
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
9502
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
10400
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...
1
7523
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
6754
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
5544
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4084
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3688
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2902
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.