Message 1 of 2

Not applicable
09-05-2017
07:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,everyone:
I got some questions while using ARXWizardMFCSupport to create a DockControlBar. I attach a button to the ChildDialog, but the size and the position keep still while I change the size of the ChildDialog. Here is my code to change size and position of the button.
GetClientRect(&m_rect); void CMyDlg::ChangeSize(UINT nID, int x, int y) { CWnd *pWnd; pWnd=GetDlgItem(nID); if(pWnd!=NULL) { CRect rec; pWnd->GetWindowRect(&rec); ScreenToClient(&rec); rec.left=rec.left*x/m_rect.Width(); rec.top=rec.top*y/m_rect.Height(); rec.bottom=rec.bottom*y/m_rect.Height(); rec.right=rec.right*x/m_rect.Width(); pWnd->MoveWindow(rec); } } void CMyDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); // TODO: Add your message handler code here if(nType!=SIZE_MINIMIZED ) { ChangeSize(IDC_BUTTON1,cx,cy); GetClientRect(&m_rect); } }
I've refer to the help documentations, and found that the CAcUiDialog class was based on CDialog class, which was based on CWnd class, so the function should be called successfully.
Can anyone tell me what I could do to achieve my goal?
Thanks a lot!
Solved! Go to Solution.