对于有窗口的控件,可以用GetWindowRect Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long
Public Declare Function GetWindowRect Lib "user32" (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 可以用这个api来得到。(数值的单位是:pixel) 在vb中的数值的单位是:Twips 需要用Screen.TwipsPerPixelX和Screen.TwipsPerPixelY来做转换。 1 pixel=about 15 twips
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
可以用这个api来得到。(数值的单位是:pixel)
在vb中的数值的单位是:Twips
需要用Screen.TwipsPerPixelX和Screen.TwipsPerPixelY来做转换。
1 pixel=about 15 twips