MFC中交换两个按钮的位置,坐标的转换真是麻烦

来源:互联网 发布:视频后期制作软件 编辑:程序博客网 时间:2024/06/05 08:02

RECT rect;  

this->GetDlgItem(IDC_STATIC_Title)->GetWindowRect(&rect);获取得是相对于屏幕的坐标
  this->GetDlgItem(IDC_STATIC_Title)->ScreenToClient(&rect);转换为客户区坐标
  this->GetDlgItem(IDC_STATIC_Title)->MapWindowPoints(this,&rect);映射到父窗口的坐标
  this->GetDlgItem(IDC_STATIC_1_Title)->MoveWindow(&rect);主要是因为MoveWindow的移动是相对于父窗口的坐标

原创粉丝点击