MFC 移动控件

来源:互联网 发布:json.parse无效字符 编辑:程序博客网 时间:2024/06/06 01:58

       将ID名为IDC_CHECK_AUTOLOGIN的控件向上移动 60

        CRect rectControl;

        LONG lnRemove = 60;   //要移动的大小
        GetDlgItem(IDC_CHECK_AUTOLOGIN)->GetWindowRect(&rectControl); //获得空间的绝对坐标
        ScreenToClient(rectControl);    //获得相对于主窗体的坐标 
        GetDlgItem(IDC_CHECK_AUTOLOGIN)->SetWindowPos(NULL, rectControl.left, rectControl.top - lnRemove, rectControl.Width(), rectControl.Height(), SWP_NOZORDER |         SWP_NOSIZE);  //设置其位置
原创粉丝点击