Help with Screen/Client coordinate systems 
Author Message
 Help with Screen/Client coordinate systems

This is the scenario.  I have a need to display a small modal form
directly below a field on another form.  This code is a usercontrol
and there are a bunch of them on the main form, so anytime the user
hits F2 in the field this form is displayed.  That is no problem.  i'm
having problems getting the form to display in the correct location.
I need it to be directly under the other field and the left border of
the form and of the control should be aligned.

What I am currently doing is this:

GetWindowRect c.hwnd, hRect
 hPoint.x = (hRect.Left + 25) * Screen.TwipsPerPixelX
 hPoint.y = (hRect.Bottom + 25) * Screen.TwipsPerPixelY
 ScreenToClient c.hwnd, hPoint
subform .Left = hPoint.x
 subform .Top = hPoint.y

Is there a more accurate way of doing this, as this doesn't seem to
always work.  In addition, I have to check that the form will fit
below the field, and if not, display above the field,   It would also
be nice if the form will not fit to the right because of the location
of the field and with width of the screen, that the form would be
right justified so that the right hand edges line up.

Anybody have any ideas on the correct way to do this ?

Mark



Sat, 21 Apr 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. How do I coordinate the screen's coordinates with a form coordinate

2. Mapping listview coordinates to screen coordinates

3. Converting container-relative coordinates to screen coordinates

4. Container-relative coordinates to screen coordinates

5. Screen coordinates change after changing screen resolution???

6. How to detect client screen resolution HELP HELP Urgent

7. Client Left and Top Coordinate with borders??

8. Client script to set mouse coordinate?

9. Client area coordinates on MDI

10. Trying to obtain the screen xy coordinates of a range of selected cells

11. Capture screen coordinates of the Explorer (View/pane) in Outlook2000

12. Coordinates of visible screen area (URG. please)

 

 
Powered by phpBB® Forum Software