Re: Resizing a CEdit control to fill its parent DialogBox???

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Peter Olcott wrote:
void CScrollBitmapDlg::OnSize(UINT nType, int cx, int cy) {
CEdit *editbox = (CEdit *) GetDlgItem(IDC_EDIT1);
RECT rect;
this->GetClientRect(&rect);
int Width = rect.right - rect.left;
int Height = rect.bottom - rect.top;
//editbox->MoveWindow(&rect);
editbox->SetWindowPos(NULL, 0, 0, Width, Height, SWP_NOMOVE | SWP_NOZORDER);
CDialog::OnSize(nType, cx, cy);
}

Why isn't this code correctly changing the size of the editbox to match the size of the DialogBox?



if (editbox)
editbox->MoveWindow(0, 0, cx, cy);

--
Scott McPhillips [VC++ MVP]

.



Relevant Pages