CRect rect;
CWnd *pWnd = GetDlgItem(IDC_STATIC_PIC);
pWnd->GetWindowRect(&rect);
ScreenToClient(&rect);

 

//先获取鼠标相对于屏幕的坐标
GetCursorPos(&point);
//然后得到static控件的rect坐标
CRect pRect;
pWnd->GetClientRect(&pRect);
//最后把当前鼠标的坐标转化为相对于rect的坐标
pWnd->ScreenToClient(&point);

 

相关文章:

  • 2021-08-13
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2021-05-22
  • 2021-08-13
  • 2022-12-23
猜你喜欢
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
  • 2021-12-21
  • 2022-12-23
相关资源
相似解决方案