移动到另一控件内的代码如下,主要内容是container那一行: Private Sub Form_Load() Load cmdTest(1) With cmdTest(1) .Caption = "Command2" .Visible = True Set .Container = Picture2 '.ZOrder End With End Sub 效果如图:代码下载: 链接:https://pan.baidu.com/s/1hVmhjMtkPCeXBgWHonqW3w 提取码:4kcs
请问这个api怎么用呀?
请问这个api怎么用呀? 4楼已经给出那么简单的办法了,还折腾API干啥
请问这个api怎么用呀?SetParent Function--------------------------------------------------------------------------------The SetParent function changes the parent window of the specified child window. SyntaxHWND SetParent( HWND hWndChild, HWND hWndNewParent ); ParametershWndChild [in] Handle to the child window. hWndNewParent [in] Handle to the new parent window. If this parameter is NULL, the desktop window becomes the new parent window. Windows 2000/XP: If this parameter is HWND_MESSAGE, the child window becomes a message-only window. Return ValueIf the function succeeds, the return value is a handle to the previous parent window.If the function fails, the return value is NULL. To get extended error information, call GetLastError. ResAn application can use the SetParent function to set the parent window of a pop-up, overlapped, or child window. The new parent window and the child window must belong to the same application. If the window identified by the hWndChild parameter is visible, the system performs the appropriate redrawing and repainting. For compatibility reasons, SetParent does not modify the WS_CHILD or WS_POPUP window styles of the window whose parent is being changed. Therefore, if hWndNewParent is NULL, you should also clear the WS_CHILD bit and set the WS_POPUP style after calling SetParent. Conversely, if hWndNewParent is not NULL and the window was previously a child of the desktop, you should clear the WS_POPUP style and set the WS_CHILD style before calling SetParent. Windows 2000/XP: When you change the parent of a window, you should synchronize the UISTATE of both windows. For more information, see WM_CHANGEUISTATE and WM_UPDATEUISTATE. Function InformationMinimum DLL Version user32.dll Header Declared in Winuser.h, include Windows.h Import library User32.lib Minimum operating systems Windows 95, Windows NT 3.1 Unicode Implemented as Unicode version. See AlsoWindows Overview, GetParent--------------------------------------------------------------------------------
Private Sub Form_Load()
Load cmdTest(1)
With cmdTest(1)
.Caption = "Command2"
.Visible = True
Set .Container = Picture2
'.ZOrder
End With
End Sub
效果如图:代码下载:
链接:https://pan.baidu.com/s/1hVmhjMtkPCeXBgWHonqW3w
提取码:4kcs
4楼已经给出那么简单的办法了,还折腾API干啥
HWND hWndChild,
HWND hWndNewParent
);
ParametershWndChild
[in] Handle to the child window.
hWndNewParent
[in] Handle to the new parent window. If this parameter is NULL, the desktop window becomes the new parent window. Windows 2000/XP: If this parameter is HWND_MESSAGE, the child window becomes a message-only window.
Return ValueIf the function succeeds, the return value is a handle to the previous parent window.If the function fails, the return value is NULL. To get extended error information, call GetLastError.
ResAn application can use the SetParent function to set the parent window of a pop-up, overlapped, or child window. The new parent window and the child window must belong to the same application. If the window identified by the hWndChild parameter is visible, the system performs the appropriate redrawing and repainting. For compatibility reasons, SetParent does not modify the WS_CHILD or WS_POPUP window styles of the window whose parent is being changed. Therefore, if hWndNewParent is NULL, you should also clear the WS_CHILD bit and set the WS_POPUP style after calling SetParent. Conversely, if hWndNewParent is not NULL and the window was previously a child of the desktop, you should clear the WS_POPUP style and set the WS_CHILD style before calling SetParent. Windows 2000/XP: When you change the parent of a window, you should synchronize the UISTATE of both windows. For more information, see WM_CHANGEUISTATE and WM_UPDATEUISTATE. Function InformationMinimum DLL Version user32.dll
Header Declared in Winuser.h, include Windows.h
Import library User32.lib
Minimum operating systems Windows 95, Windows NT 3.1
Unicode Implemented as Unicode version. See AlsoWindows Overview, GetParent--------------------------------------------------------------------------------
设置控件的所属对象。