CFormView - (Elastic) Annoying Flashes
Manish J. Dalal -- mjdalal@bectel.com
Friday, April 12, 1996
VC++ 4.0, Win NT 3.51
I am trying to implement an Elastic View based on CFormView. In order to resize
controls, I am overriding OnSize >>
void CElasticView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// my code
if (m_ok == 1) {
CTreeCtrl* pTree = (CTreeCtrl*)GetDlgItem(IDC_TREEVIEW1);
CRect rect;
rect.left = cx/500;
rect.top = cy/500;
rect.right = cx/3;
rect.bottom = cy - cy/500;
pTree->MoveWindow(&rect,FALSE);
//similar for other controls
}
}
Although this works, when user resizes, it leads to annoying flashes,
because of window erasing background. From Mike B's Book(Rev Win32), I
know (well I may be completely off the trak!) that I have to play
around with OnEraseBackground(?), but I am completely lost. Any help
will be appreciated.
Thanks,
Manish Dalal
mjdalal@bechtel.com
Mike Blaszczak -- mikeblas@msn.com
Wednesday, April 17, 1996
From: owner-mfc-l@netcom.com on behalf of Manish J. Dalal
Sent: Friday, April 12, 1996 08:07
> VC++ 4.0, Win NT 3.51
Thanks.
> I am trying to implement an Elastic View based on CFormView. In order to
resize
> controls, I am overriding OnSize >>
What is an "elastic view"?
> pTree->MoveWindow(&rect,FALSE);
> // similar
If you mean that you're caling MoveWindow() many times, this might be the root
of your problem. Maybe you should read up on BeginDeferWindowPos(),
DeferWindowPos(), and EndDeferWindowPos().
.B ekiM
TCHAR sz[] = _T("Computers are for sissies.");
| Вернуться в корень Архива
|