vc 获取和设置控件的大小

 

 

CWnd*   pWnd   =   GetDlgItem(IDC_STATIC1);  

  CRect   recrt,rect2;

 recrt.left;//左上x坐标

 recrt.top;//左上y坐标

 recrt.right;//右下x坐标

 recrt.bottom;//右下y坐标

    recrt.Width();//宽

    recrt.Height();//高


 pWnd->GetClientRect(&recrt);//相对控件本身的坐标recrt.left=0;recrt.top=0;

 pWnd->GetWindowRect(&rect2);//相对与窗体的坐标

 pWnd->MoveWindow(0,0,800,600,1);//设置控件的位置和大小

 

你可能感兴趣的:(vc)