也可以利用API函数: Option Explicit Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Private Sub Command2_Click() SetParent Command1.hWnd, Frame1.hWnd Command1.Left = 30 Command1.Top = 150 End Sub
'以下两句是定位,你可以不用
Command1.Left = 30
Command1.Top = 150
Option Explicit
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub Command2_Click()
SetParent Command1.hWnd, Frame1.hWnd
Command1.Left = 30
Command1.Top = 150
End Sub