473,811 Members | 2,685 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determining Mouse Possition

What i want to do, is, in the Activate Event of my form, determine which is the mouse possition, or, maybe even easy, just determine
if the mouse is over my form.
I need to do two differents things on that event, based on if the mouse is over the form or not..

Any help?

Thanks.
Nov 20 '05 #1
5 1507
Hi,

Dim pt As Point = Cursor.Position

will return the postion in screen coordinates.

Ken

------------------

"Smoke" <sm***@netgate. com.uy> wrote in message
news:um******** ******@TK2MSFTN GP09.phx.gbl...
What i want to do, is, in the Activate Event of my form, determine which
is the mouse possition, or, maybe even easy, just determine
if the mouse is over my form.
I need to do two differents things on that event, based on if the mouse is
over the form or not..

Any help?

Thanks.

Nov 20 '05 #2
Smoke,
Have you looked at Control.MousePo sition, Control.MouseBu ttons &
Control.Modifie rKeys all shared properties.

Remember that Control.MousePo sition is in Screen Coordinates, so you need to
use Control.PointTo Client to convert into client coordinates, then you can
use Control.ClientR ectangle.Contai ns to see if the point is on the
ClientArea.

You can use Control.Bounds if you want to include the Non-client area of the
form.

Remember that Form inherits from Control, so the above properties are valid
for Forms also.

Hope this helps
Jay

"Smoke" <sm***@netgate. com.uy> wrote in message
news:um******** ******@TK2MSFTN GP09.phx.gbl...
What i want to do, is, in the Activate Event of my form, determine which is the mouse possition, or, maybe even easy, just determine if the mouse is over my form.
I need to do two differents things on that event, based on if the mouse is over the form or not..
Any help?

Thanks.

Nov 20 '05 #3
* "Smoke" <sm***@netgate. com.uy> scripsit:
What i want to do, is, in the Activate Event of my form, determine which is the mouse possition, or, maybe even easy, just determine
if the mouse is over my form.


\\\
If Me.Bounds.Conta ins(Cursor.Posi tion) Then
...
End If
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Perfect, i got it working! :) thanks alot

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message news:Oc******** ******@tk2msftn gp13.phx.gbl...
* "Smoke" <sm***@netgate. com.uy> scripsit:
What i want to do, is, in the Activate Event of my form, determine which is the mouse possition, or, maybe even easy, just determine if the mouse is over my form.


\\\
If Me.Bounds.Conta ins(Cursor.Posi tion) Then
...
End If
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #5
Thanks, your explanation was very usefull

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message news:u0******** ******@TK2MSFTN GP10.phx.gbl...
Smoke,
Have you looked at Control.MousePo sition, Control.MouseBu ttons &
Control.Modifie rKeys all shared properties.

Remember that Control.MousePo sition is in Screen Coordinates, so you need to
use Control.PointTo Client to convert into client coordinates, then you can
use Control.ClientR ectangle.Contai ns to see if the point is on the
ClientArea.

You can use Control.Bounds if you want to include the Non-client area of the
form.

Remember that Form inherits from Control, so the above properties are valid
for Forms also.

Hope this helps
Jay

"Smoke" <sm***@netgate. com.uy> wrote in message
news:um******** ******@TK2MSFTN GP09.phx.gbl...
What i want to do, is, in the Activate Event of my form, determine which

is the mouse possition, or, maybe even easy, just determine
if the mouse is over my form.
I need to do two differents things on that event, based on if the mouse is

over the form or not..

Any help?

Thanks.


Nov 20 '05 #6

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

Similar topics

5
6230
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 buttons, which is fine most of the time (he comes from a Mac environment, so I accept mouse clicks from the right or left button when he's working on the PC). But every once in a while, he'll press and hold the right mouse button, move onto a JButton,...
4
10443
by: Paul Thompson | last post by:
How do I determine in JavaScript the name of the object that focus is on?
9
22756
by: punkin | last post by:
I am trying to catch mouse position on the entire screen by dynamically generating mouse click event at every 100 ms. My code only works for IEs but not any Netscape or Gecko-based browsers. The following are the problems and I hope that there is someone who can enlighten me or give me some pointers. Also, my testing code is attached at the end. And please don't ask me why I am doing this - it is one of functional requirements by all...
3
3610
by: mitsura | last post by:
Hi, I have included a small listing. The test program opens a panel and show a bitmap. What I want is to when the mouse is over the bitmap panel, I want to trap the left mouse click. The purpose is to get the position of the mouse pointer on the bitmap. However, for some reason, the left (I also tried right) mouse clicks are not intercepted. I new to Python and wxWindows so any help would be greatly appreciated.
1
4031
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the same way a menu does. To do this my control needs to get notified when the user tried to click off of it. The Leave and LostFocus events of the UserControl work most of the time but not always. For example, if they click on a part of the form...
1
1472
by: blue | last post by:
I have a table that I want to have a set width and height. The table has a title and the text may be larger than the width of the table. If the text is too large to fit into the table, it either line breaks or stretches the width of the table depending on how large a word is. For example, "this is a really long title" would line break, and "this_is_a_really_long_word", would stretch the width of the title I need the tables to be an...
4
1353
by: piggy | last post by:
I want to do something, but i dont know how clear i'm going to explain it. Please help me with this matter. Following is what i want to b done. i'm doing a web site which has several items (which suppos to b links) listed one after one. When u click on each item, there is a description to b appeared over the page. What i want is, this description page (or rather a box) should appear over the excisting details of the page, and also i...
3
2977
by: c_shah | last post by:
VB 2005 and windows form application I am having difficulty putting my question into words but.. Is there a way to determine whether my win form application has focus or it is active or being used?
4
6979
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I just gotta fix it. I need to make some calculations on the measurements and VB6 is my language. Yes, the system mouse will corrupt the measurement, but it's an auditing function and that's acceptable.
0
9727
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
10647
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
10386
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
10398
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
6889
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
5554
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
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
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
3
3017
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.