473,808 Members | 2,775 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Location of a control relative to form edges?

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 the Location of the control, it is
relative to the containing GroupBox, and the Location of that GroupBox is
relative to its containing GroupBox. Only the location of the outermost
GroupBox is relative to the edges of the form itself. So, what I've been
doing is simply adding the coordiantes of all these together to get what I
need. However, this isn't a good solution since I may want to remove/add
containing GroupBoxes, thereby necessitating code changes. Is there a clean
way to just get the Location of any control relative to the edges of the form
itself?

Thanks,
Ray
Aug 20 '07 #1
1 3228
take a look at PointToScreen and PointToClient

Aug 21 '07 #2

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

Similar topics

2
12042
by: Catherine Lynn Wood | last post by:
I need to know how to overlap DIV content within 'relative' associated rendering. I am building div layers in the middle of a page and when I set positioning to absolute in the CSS, it references back to 0,0 on the entire page. If I set it to relative, the div layers will not overlap as needed. I prefer to avoid javascripting an 'innerHTML' re-write of a single div and would instead like to build two layers that can reside at the same...
1
1487
by: steve bull | last post by:
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
1
2315
by: JJ | last post by:
Hi, I am buidling some controls dynamically in the .cs file, context menu. I am wondering if there is any chance I could obtain the location of any controls and set the location of another control to that location. i.e. just setting and getting the location. Concern: 1.When is the best time to get the location? After PageLoad? CreateChildControls?
1
9429
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 upper left hand corner is positioned exactly in the middle of the button that was pressed (Button1). I can't seem to get the knack of Location() and PointToScreen() to position the new form here. According to the help, location() is to do
4
5074
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 subtractions of the form location and the control location it is possible to get the relative cursor location to the screen.... with one exception - form has a title bar, and border widths which I do not know the values of. Is there a way to find...
11
2876
by: herman404 | last post by:
Hi everyone, I have a DataGrid that displays data on a dialog application. When the dialog is resized, the datagrid keeps the same shape, We would need the datagrid to keep a relative shape compared to the rest of the dialog when the user resizes it. Any ideas on how to do this? Thanks!
5
27629
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
0
990
by: Claes Wedin | last post by:
We had a BaseForm with some code that we inhereted for new forms from by simply changing ": Form" to ": BaseClasses.BaseForm". There were no problems... Then we added a Cancel and a Save button to the BaseFrom. The buttons are anchord to Bottom and Right. Now they do not appear to position according to the anchor, but appears at the fixed positions in the alreade created forms... When I create a new form using Add --New Item --Inherited...
2
5462
by: ducttape | last post by:
Hello I'm busy working with an MDI parent and child forms. I've found that there is a discrepancy between the locations returned by DesktopLocation, Control.MousePosition and MouseEventArgs e.Location, but I can't work out why or what exactly the discrepancy is. My forms are all custom without title bars and thus I've had to create my own moving methods, etc. This is obviously related to the location of the mouse pointer. My mouse...
0
9721
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...
1
10374
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
10114
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9196
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
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
5548
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...
1
4331
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
3011
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.