반응형
void CDICOMViewerDlg::OnSize(UINT nType, int cx, int cy) { CDialogEx::OnSize(nType, cx, cy); MoveControlsToRight(); CRect clientRect; GetClientRect(clientRect); m_LastClientBottomRight = clientRect.BottomRight(); } void CDICOMViewerDlg::MoveControlsToRight() { CWnd* pBtnNone = GetControl(IDC_BTN_NONE); CWnd* pBtnZoom = GetControl(IDC_BTN_ZOOM); CWnd* pBtnPan = GetControl(IDC_BTN_PAN); CWnd* pBtnRot = GetControl(IDC_BTN_ROTATE); CWnd* pBtnFit = GetControl(IDC_BTN_FIT); CWnd* pBtnHFlip = GetControl(IDC_BTN_HFLIP); CWnd* pBtnVFlip = GetControl(IDC_BTN_VFLIP); MoveControlToRight(pBtnNone); MoveControlToRight(pBtnZoom); MoveControlToRight(pBtnPan); MoveControlToRight(pBtnRot); MoveControlToRight(pBtnFit); MoveControlToRight(pBtnHFlip); MoveControlToRight(pBtnVFlip); } void CDICOMViewerDlg::MoveControlToRight(CWnd* control) { if (control->GetSafeHwnd()) { CRect clientRect; GetClientRect(clientRect); CRect wndRect; control->GetWindowRect(wndRect); ScreenToClient(wndRect); CPoint offset = clientRect.BottomRight() - m_LastClientBottomRight; // move to right , bottom //wndRect.OffsetRect(offset); // move to right wndRect.OffsetRect(offset.x, 0); control->MoveWindow(wndRect); control->Invalidate(); } } CWnd* CDICOMViewerDlg::GetControl(int nId) { return (CWnd*)GetDlgItem(nId); }

반응형
'[====== Development ======] > C++' 카테고리의 다른 글
| Log4cxx Library Build (0) | 2021.07.30 |
|---|---|
| c++/cli 문자 타입 변환 (1) | 2021.07.24 |
| GetVersionExA 에러 (0) | 2021.07.22 |
| C++ MBCS 경고 무시 (0) | 2021.06.08 |
| C++ Multibyte to Unicode (0) | 2021.06.04 |