how calc the DesktopLocation of a control on a Form?

  • Thread starter Thread starter Steve Richter
  • Start date Start date
S

Steve Richter

I am using ShowDialog to show a popup form and want to position the
popup relative to the control on the form the popup is pertinent to.
For this, I am using FormStartPosition.Manual to set the position of
the form relative to the desktop.

I can calc the location of a control relative to the client rect of a
form. But since I am positioning the popup form relative to the
desktop, I need to know the DesktopLocation of controls on the form.

thanks,
 
Hi,

the Control class has a PointToScreen method which turns coordinates
expressed relative to the control's location into coordinates that are
relative to the top left corner of the desktop.

Thorsten
 
nevermind, got it. PointToScreen and PointToClient. very nice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top