473,503 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I calculate the location of a widget relative to the form on which it lies?



I have a picture box which lies on a panel which lies on a form. Is there some way that I can calculate the position of
the picture box relative to the form rather than the panel on which it lies? The location of the picture box in the
Control class is given relative to the panel on which it lies.
Thanks,

Steve
Nov 17 '05 #1
1 1469
There might be a better way to do this, but one way is to convert the child
controls location into screen coordinates and then convert that point back
to client coordinates using the Form. Something like the code below, where
"this" is a reference to the Form.

Point p =
this.PointToClient(this.panel1.PointToScreen(this. pictureBox1.Location));

--
Tim Wilson
..Net Compact Framework MVP

"steve bull" <bu****@comcast.net> wrote in message
news:t6********************************@4ax.com...


I have a picture box which lies on a panel which lies on a form. Is there some way that I can calculate the position of the picture box relative to the form rather than the panel on which it lies? The location of the picture box in the Control class is given relative to the panel on which it lies.
Thanks,

Steve

Nov 17 '05 #2

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

Similar topics

53
5656
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
1
1963
by: Susan Bricker | last post by:
Greetings. I am trying to position opened forms so that they are cascaded on the screen. I have discovered the movesize action (for the DoCmd) and Move property of a form (for Acc 2002/2003). ...
1
9392
by: Colin McGuire | last post by:
Thanks everyone for help in my previous post. Using the "Point.op_Addition" from the previous post I have to now focus on the real problem. I need to manually position a new form so that its...
4
5055
by: Strahimir Antoljak | last post by:
I want to track the cursor location relative to a control on the form. I am aware of System.Windows.Forms.Cursor.Position which provides absolute cursor position relative to the screen. With right...
6
2872
by: G*rd*n | last post by:
I have been using the HTTP "Location" reponse header to direct a symbolic request to a CGI program to an actual URL/file. For example, let us suppose the CGI program's table indicates xyz ->...
23
3592
by: lwoods | last post by:
I am trying to pass some info to another page on my site. I set "session_start()" in page 1, assign a session variable to a value, then execute a "header('Location: ....')." But on the target...
5
27581
by: Jon Slaughter | last post by:
Is there a way to get a controls location in screen coordinates? (not relative to the container it is in)? Thanks, Jon
1
3218
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a control that is inside a GroupBox, and that GroupBox is inside another group box. I would like to find the location of the control relative to the form itself. When I examine...
0
1318
by: euschenk | last post by:
I'm making a flash widget that I have a quick question on. The widget will be used to display statistics throughout the day and every few hours the stat will change. The statistics will be grabbed...
0
7205
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
7093
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...
0
7349
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...
1
7008
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...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
399
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...

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.