How do I coordinate the screen's coordinates with a form coordinate 
Author Message
 How do I coordinate the screen's coordinates with a form coordinate

Hi there

I just ran into a little problem !
Ive made a pop-up menu using some API calls.
These uses the screens x,y to place the menu.
What I need is a small routine, so that the menu open at the same place on
a form regardless where on the screen its placed.

So roughly the problem is to translate a position on screen (in pixels) to
a .Top and .Left of a form

Anders



Tue, 07 May 2002 03:00:00 GMT  
 How do I coordinate the screen's coordinates with a form coordinate
Hi Anders,

You can use the ScreenToClient() API. It will convert the screen coordinates
to coordinates relative to the upper left corner of your window.

Type POINTAPI
        x As Long
        y As Long
End Type

Declare Function ScreenToClient Lib "user32" Alias "ScreenToClient" _
                                    (ByVal hwnd As Long, lpPoint As POINTAPI)
As Long

Regards,
                Stoil

Quote:

> Hi there

> I just ran into a little problem !
> Ive made a pop-up menu using some API calls.
> These uses the screens x,y to place the menu.
> What I need is a small routine, so that the menu open at the same place on
> a form regardless where on the screen its placed.

> So roughly the problem is to translate a position on screen (in pixels) to
> a .Top and .Left of a form

> Anders



Tue, 07 May 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Mapping listview coordinates to screen coordinates

2. Converting container-relative coordinates to screen coordinates

3. Container-relative coordinates to screen coordinates

4. Cartesian Coordinates vs Picture Box Coordinates

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

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

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

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

9. Help with Screen/Client coordinate systems

10. Screen (Caret) Coordinates in Shelled Windows Applications

11. coordinates of mouse in all the screen

12. How can I convert screen to printer coordinates???

 

 
Powered by phpBB® Forum Software