如何获取当前窗体在屏幕中的位置(坐标)
如题,谢谢
[解决办法]
Public Declare Function GetWindowRect Lib "user32 " Alias "GetWindowRect " (ByVal hwnd As Long, lpRect As RECT) As Long
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
dim r as rect
GetWindowRect Me.hWnd , r
Debug.Print r.Left , r.Top
[解决办法]
Me.Left, Me.Top, Me.Width, Me.Height
如果要转换为 Pixel 单位分别除以 Screen.TwipsPerPixelX、Screen.TwipsPerPixelY
[解决办法]
窗体里加个定时器
然后:
Option Explicit
Private Sub Timer1_Timer()
Me.Caption = Me.Top \ 15 & ": " & Me.Left \ 15
End Sub