472,371 Members | 1,448 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,371 software developers and data experts.

Coordinates related to form and not screen

Rob
Hi,

I have a form which has a panel which has a picturebox inside of that.
When a user clicks on the picture, it zooms by x2. The panel has
autoscroll set to true, so when the image is larger then the panel, I
can scroll to a different part of it. What I'm looking to do is when a
user clicks on the image,the point at which he/she clicks is then
centered in the panel by using autoscrollposition. My problem is that
I'm not sure of how to get x,y of the mouse position related to the
panel and not the screen. So either

A.) How can I get the x/y of the mouseposition related to the panel
only or
B.) How can I get the position of the upper lefthand corner of the
panel x/y related to the screen then subtract that or
C.) I'm just a noob

Thanks in advance
Rob
Nov 20 '05 #1
2 1422
Hi,

The form and all controls have the PointToClient method returns
the converted coordinates. Here is an example for a form

Dim pt As Point = Me.PointToClient(Cursor.Position)
Ken
-----------------
"Rob" <hu****@hotmail.com> wrote in message
news:42*************************@posting.google.co m...
Hi,

I have a form which has a panel which has a picturebox inside of that.
When a user clicks on the picture, it zooms by x2. The panel has
autoscroll set to true, so when the image is larger then the panel, I
can scroll to a different part of it. What I'm looking to do is when a
user clicks on the image,the point at which he/she clicks is then
centered in the panel by using autoscrollposition. My problem is that
I'm not sure of how to get x,y of the mouse position related to the
panel and not the screen. So either

A.) How can I get the x/y of the mouseposition related to the panel
only or
B.) How can I get the position of the upper lefthand corner of the
panel x/y related to the screen then subtract that or
C.) I'm just a noob

Thanks in advance
Rob

Nov 20 '05 #2
PointToClient and PointToScreen methods may do what you need !

Regards - OHM
Rob wrote:
Hi,

I have a form which has a panel which has a picturebox inside of that.
When a user clicks on the picture, it zooms by x2. The panel has
autoscroll set to true, so when the image is larger then the panel, I
can scroll to a different part of it. What I'm looking to do is when a
user clicks on the image,the point at which he/she clicks is then
centered in the panel by using autoscrollposition. My problem is that
I'm not sure of how to get x,y of the mouse position related to the
panel and not the screen. So either

A.) How can I get the x/y of the mouseposition related to the panel
only or
B.) How can I get the position of the upper lefthand corner of the
panel x/y related to the screen then subtract that or
C.) I'm just a noob

Thanks in advance
Rob


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #3

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

Similar topics

3
by: Need_help | last post by:
Sorry for inconveniance, but I couldn't check the newsgroup since friday. I can't see any solutions right now on my post... So, one more time... (if anyone noticed the solution)... I have...
2
by: Robin Senior | last post by:
Hi, I'm trying to drag and drop onto a Panel on my form. The panel is inside a groupBox, which of course is inside my form. When dropping the item onto my Panel, I want it to appear at that...
3
by: ZorpiedoMan | last post by:
Help... I need the screen coordinates of a control so I can place a pop up form underneath it. --Zorpy *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in...
4
by: Henry Wu | last post by:
Hi, I see examples of Magnifying an area under mouse coordinates to a form or picturebox using VB6 and VC6, does anyone know how to do it under VB.NET? Its nice to use the new GDI+ for it. ...
3
by: aam | last post by:
Hi. I am trying to find the cursor coordinates inside of a window, not a form. I would like to display the coordinates of the cursor when you click inside of the window. Either that, or have the...
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...
9
by: pcnerd | last post by:
I created a demo program with a status bar & status bar label on the form. When the program runs, it's maximized. When I move the mouse over the form, I can see the X & Y coordinates changing on...
3
by: steve | last post by:
Hi All I have textboxes within a TableLayoutpanel and I want to be able to position an independant control adjacent to a selected textbox This independent control allows selection of text to...
0
by: raylopez99 | last post by:
keywords: logical coordinates, page coordinates, world coordinates, device coordinates, physical coordinates, screen coordinates, client coordinates. offset rectangle. WYSIWYG rubber rectangle...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.