2009-04-28 25 views

答えて

4

コントロールを移動するために、CWnd :: MoveWindow()を使用できます。 CWnd :: GetDlgItem()は、指定されたコントロールIDのCWndを取得します。

コントロールの親ウィンドウのクラス内から呼び出されるいくつかの擬似コード:

RECT windowRect; 
GetClientRect(&windowRect);// Bounds of the current window 

CWnd* controlWindow = GetDlgItem(controlId); 
RECT controlRect; 
controlWindow->GetWindowRect(&controlRect);//control rectangle 
ScreenToClient(&controlRect);//control rectangle in the coordinate system of the parent 

const int vertOffset = windowRect.top - controlRect.top;//how much to adjust 
controlRect.top += vertOffset; 
controlRect.bottom += vertOffset; 
controlWindow->MoveWindow(&controlRect); 
+0

は、あなたは私がより明確になりますことを、コードのサンプルまたは任意の例を示すことができます。 –

+0

サンプルコードがうまく見える - – Jeff

関連する問題