472,811 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Form cursor X and Y pixel coordinates

Hello,
I want to try to retrieve the cursor position x and y relative to the form
the cursor is over.

The way I am doing it now is:

1. Retrieve the left and top position of the form relative to the desktop
2. Retrieve the desktop cursor position.
3. Take the difference of the forms left and top position. Adjust the
desktop cursor position based on this.

Is there an easier way? Is there a property within System.Windows.Forms
/controls that already calculates this?

Sorry if this is a stupid question.

Sincerely,

Dan

Nov 15 '05 #1
1 13104
see http://www.syncfusion.com/FAQ/WinFor...c50c.asp#q597q

Point ptCursor = Cursor.Position;
ptCursor = PointToClient(ptCursor);

hth, mike
"Dan H." <Da**@projectavatar.com> wrote in message
news:uL*************@TK2MSFTNGP12.phx.gbl...
Hello,
I want to try to retrieve the cursor position x and y relative to the form the cursor is over.

The way I am doing it now is:

1. Retrieve the left and top position of the form relative to the desktop 2. Retrieve the desktop cursor position.
3. Take the difference of the forms left and top position. Adjust the desktop cursor position based on this.

Is there an easier way? Is there a property within System.Windows.Forms /controls that already calculates this?

Sorry if this is a stupid question.

Sincerely,

Dan

Nov 15 '05 #2

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

Similar topics

10
by: Danny | last post by:
How can I get the coordinates of the mouse cursor in Mozilla browsers as well as Opera and IE6? I'm struggling to understand how to capture mouse movement events with Mozilla/Netscape/Firefox and...
1
by: Dave Hammond | last post by:
I have an html element (a link) with an onclick handler which opens a popup window, and would like to position that window at the coordinates where the element appears on the page. I have...
11
by: Jozef | last post by:
I have some old code that I use from the Access 95 Developers handbook. The code works very well, with the exception that it doesn't seem to recognize wide screens, and sizes tab controls so that...
4
by: Tomasz Bak | last post by:
Hello, I have a simple problem: mark a list of defects on an image. I think the best way to do it is to select a single deffect, then take two coordinates of coursor form an image on a web...
30
by: Chaos | last post by:
As my first attempt to loop through every pixel of an image, I used for thisY in range(0, thisHeight): for thisX in range(0, thisWidth): #Actions here for Pixel thisX, thisY But it takes...
1
by: jojoba | last post by:
Hi I am trying to determine coordinates of something in a webpage. All i have is a subset of html that i know exists in a given webpage. Now i want to find that subsetHtml in the page and...
1
by: morangi | last post by:
<?php session_start(); error_reporting(E_ERROR && ~E_NOTICE && ~E_WARNING); ob_start(); $link = mysql_connect('localhost', 'root', 'test'); if (!$link) { die('Could not connect: ' ....
1
by: dazzler | last post by:
I have up to 100data points over 400x400pixel area, when the user would move mouse cursor over one point, the application would detect it and show additional information about it. I have all x,y...
1
by: akscol | last post by:
I have created a panel in visual basics which has buttons.These buttons when clicked open respective applications to which its directed for eg microsoft word, internet explorer, etc.I have also...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.