Rigel
August 1st, 2008, 05:09 PM
I'm using RectangleToScreen to try to find the exact screen coordinates of a control in a form.
Rectangle rectQD = m_qd.Control.FindForm().RectangleToScreen(m_qd.Control.Bounds);
This piece of code above sometimes works. I've seen this sometimes return the screen location of the parent form not the location of the control residing in it. ???
Rectangle rectQD = m_qd.Control.RectangleToScreen(m_qd.Control.FindForm().ClientRectangle);
This piece of code above always returns the correct screen location of the control. But it doesn't make any sense to me. Can someone explain?
Thank you,
Rectangle rectQD = m_qd.Control.FindForm().RectangleToScreen(m_qd.Control.Bounds);
This piece of code above sometimes works. I've seen this sometimes return the screen location of the parent form not the location of the control residing in it. ???
Rectangle rectQD = m_qd.Control.RectangleToScreen(m_qd.Control.FindForm().ClientRectangle);
This piece of code above always returns the correct screen location of the control. But it doesn't make any sense to me. Can someone explain?
Thank you,