473,386 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 13137
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.