form1.top+command1.top
form1.left+command1.left

解决方案 »

  1.   

    The ClientToScreen function converts the client coordinates of a specified point to screen coordinates.Declare Function ClientToScreen Lib "user32" Alias "ClientToScreen" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
    キ hWnd
    Identifies the window whose client area is used for the conversion.キ lpPoint
    Points to a POINT structure that contains the client coordinates to be converted. The new screen coordinates are copied into this structure if the function succeeds.
      

  2.   

    对于有hwnd的控件,使用以下代码可以获取位置;
    对于无HWND的我就不知道了。Option Explicit
    Private Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As LongPrivate Sub Command1_Click()
        Dim a As RECT
        
        Call GetWindowRect(Text1.hwnd, a)
        MsgBox a.Left & "," & a.Top
    End Sub
      

  3.   

    请参阅我的发言
    我有一个窗体,上面有一个按钮,如何让窗体隐藏,按钮还显示呢?
    http://www.csdn.net/expert/topic/372/372380.shtm