vb编程,command如何移出frame?
来源:百度知道 编辑:UC知道 时间:2024/05/28 10:00:56
当然可以,小意思...设置Command1的新父...Frame1其实是Command1的一个父组件,更改成Frame2就可以了..
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub Command1_Click()
SetParent Command1.hWnd, Frame2.hWnd
End Sub
-------------------------------------------------------------------------------------------------
按照你的要求写的
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function GetParent Lib "user32" (ByVal hWndChild As Long) As Long
Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If GetParent(Command1.hWnd) <> Frame1.hWnd Then SetParent Command1.hWnd, Frame1.hWnd
Command1.Move X, Y
End Sub
Private Sub Frame2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Si