You can use the ClientToScreen() API function to convert a point from client coordinates to screen coordinates:
Dim Position As Point Position.x = 0 Position.y = 0 ClientToScreen Me.hWnd, Position FormTop = Position.y
If you want to skip this and go straight to the button, you can use the button position (in pixels):
Position.x = This.ScaleX(Button.Left, this.ScaleMode, vbPixels) Position.Y = This.ScaleY(Button.Top, this.ScaleMode, vbPixels) ...
Or just set the position of the buttons using GetWindowRect()
Dim Position2 As Rect GetClientRect Button.hWnd, Position2 Position.x = Position2.left Position.y = Position2.top ...
Deanna
source share