对话框上一个控件调用SetWindowPos改变其大小后,再调用GetWindowRect发现还是原来的大小,
怎么回事呢?

解决方案 »

  1.   

    SetWindowPos的详细参数发来看看
      

  2.   

    SetWindowPos(0,0,textSize.cx,textSize.cy,SWP_NOMOVE,NULL)
      

  3.   

    SetWindowPos(NULL,0,0,textSize.cx,textSize.cy,SWP_NOMOVE|SWP_NOZORDER)
      

  4.   


    调用SetWindowPos后需要刷新界面吗?
      

  5.   

    楼主仔细查看MSDN.第一个参数是CWnd*
      

  6.   

    SetWindowPos(m_hWnd, NULL, 0,0,textSize.cx,textSize.cy,SWP_NOMOVE)
      

  7.   

    肯定是SetWindowPos的参数传错了,给你一个我程序里的,测试过是变化的 RECT rect;
    CClientDC dc(this);
    int Client_H;
    int width = dc.GetDeviceCaps(HORZRES);
    int height = dc.GetDeviceCaps(VERTRES);
    GetWindowRect(&rect); //rect-dialog坐标
    int Client_X = width - (rect.right - rect.left);
    Client_Y = 91; switch (iFlag)
    {
    case SMALL: 
    Client_H = 203;
    break;
    case BIG:
    Client_H = 630; //(rect.bottom - rect.top);
    break;
    default:;
    }
     
    SetWindowPos(&wndTopMost, Client_X,Client_Y,
    (rect.right - rect.left),Client_H, SWP_SHOWWINDOW); GetWindowRect(&rect);
    CString ss;
    ss.Format("client_Y=%d",rect.bottom - rect.top);
    AfxMessageBox(ss);
      

  8.   

    iflag是传入的参数,变大还是变小