CWnd *pWnd;
pWnd = (CWnd *)GetDlgItem(IDC_EDIT);
if(pWnd )
{
CRect rect;
CRect WindowRect;
pWnd->GetWindowRect(rect);
GetClientRect(WindowRect);
ScreenToClient(rect);
rect.right = WindowRect.Width() * 80 / 320 + rect.left;
rect.bottom = WindowRect.Height() * 20 / 200 + rect.top;
pWnd->MoveWindow(rect);
}

解决方案 »

  1.   

    在窗体的OnSize里
    CRect rect;
    GetClientRect(&rect);
    CRect rc = CRect(0,0,rect.Width, rect.Height);
    CTreeCtrl* pTree = 你的树型控件;
    pTree->MoveWindow(rc);
      

  2.   

    请问cpunion(全心全意),
    CTreeCtrl* pTree = 你的树型控件;这段代码等号右边我应该写什么,是空间的ID吗?
      

  3.   

    可是我这样写以后就报错了
    CTreeCtrl* pTree = IDC_TREE;
    错误提示
    error C2440: 'initializing' : cannot convert from 'const int' to 'class CTreeCtrl *'