Opening a form over a control

  • Thread starter Thread starter RC
  • Start date Start date
R

RC

Can anyone explain how set the location of a new windows form based aginst
the current loctaion of a control on a form, ie formA has a text control in
a group box and when the user starts typing in the text box I want to be
able to open a new form over the exact location of the textbox. the problem
I am having is that the textbox location is offset based aginst the groupbox
and not the form, pulling my hair out please help :)
 
Hello,

Yes, Joe's suggestion is right. You may use the Control.PointToScreen
method to get the location of the specified client point into screen
coordinates. If you want to translate it back, the ScreenToClient method
will be helpful to do that.

Best regards,

Lion Shi [MSFT]
MCSE, MCSD
Microsoft Support Engineer
Get Secure! ¨C www.microsoft.com/security

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2003 Microsoft Corporation. All rights
reserved.
--------------------
| Message-ID: <[email protected]>
| Date: Sat, 02 Aug 2003 00:05:29 -0500
| From: Joe White <[email protected]>
| User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2)
Gecko/20030208 Netscape/7.02
| X-Accept-Language: en-us, en
| MIME-Version: 1.0
| Subject: Re: Opening a form over a control
| References: <[email protected]>
| Content-Type: text/plain; charset=us-ascii; format=flowed
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: ip68-96-138-248.om.om.cox.net 68.96.138.248
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:49455
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Take a look at Control.PointToScreen().
|
|
| RC wrote:
| > Can anyone explain how set the location of a new windows form based
aginst
| > the current loctaion of a control on a form, ie formA has a text
control in
| > a group box and when the user starts typing in the text box I want to be
| > able to open a new form over the exact location of the textbox. the
problem
| > I am having is that the textbox location is offset based aginst the
groupbox
| > and not the form, pulling my hair out please help :)
|
|
 
Sorry for the typo error. Thanks Joe, it should be PointToClient.

Best regards,

Lion Shi [MSFT]
MCSE, MCSD
Microsoft Support Engineer
Get Secure! ¨C www.microsoft.com/security

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2003 Microsoft Corporation. All rights
reserved.
--------------------
| Message-ID: <[email protected]>
| Date: Mon, 04 Aug 2003 07:58:32 -0500
| From: Joe White <[email protected]>
| User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2)
Gecko/20030208 Netscape/7.02
| X-Accept-Language: en-us, en
| MIME-Version: 1.0
| Subject: Re: Opening a form over a control
| References: <[email protected]>
<[email protected]> <[email protected]>
| Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| Content-Transfer-Encoding: 8bit
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: ip68-96-138-248.om.om.cox.net 68.96.138.248
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:49523
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| In .NET, it's PointToClient (not ScreenToClient).
|
|
| Lion Shi wrote:
| > Hello,
| >
| > Yes, Joe's suggestion is right. You may use the Control.PointToScreen
| > method to get the location of the specified client point into screen
| > coordinates. If you want to translate it back, the ScreenToClient
method
| > will be helpful to do that.
| >
| > Best regards,
| >
| > Lion Shi [MSFT]
| > MCSE, MCSD
| > Microsoft Support Engineer
| > Get Secure! ¨C www.microsoft.com/security
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > You assume all risk for your use. 2003 Microsoft Corporation. All
rights
| > reserved.
| > --------------------
| > | Message-ID: <[email protected]>
| > | Date: Sat, 02 Aug 2003 00:05:29 -0500
| > | From: Joe White <[email protected]>
| > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2)
| > Gecko/20030208 Netscape/7.02
| > | X-Accept-Language: en-us, en
| > | MIME-Version: 1.0
| > | Subject: Re: Opening a form over a control
| > | References: <[email protected]>
| > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Newsgroups: microsoft.public.dotnet.framework.windowsforms
| > | NNTP-Posting-Host: ip68-96-138-248.om.om.cox.net 68.96.138.248
| > | Lines: 1
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| > microsoft.public.dotnet.framework.windowsforms:49455
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
| > |
| > | Take a look at Control.PointToScreen().
| > |
| > |
| > | RC wrote:
| > | > Can anyone explain how set the location of a new windows form based
| > aginst
| > | > the current loctaion of a control on a form, ie formA has a text
| > control in
| > | > a group box and when the user starts typing in the text box I want
to be
| > | > able to open a new form over the exact location of the textbox.
the
| > problem
| > | > I am having is that the textbox location is offset based aginst the
| > groupbox
| > | > and not the form, pulling my hair out please help :)
|
|
 
Back
Top