hitesh17
asked on
How to reduce Flickering in a FormView while resizing?
I've around 50 controls on a FormView.
I noticed a lot of flickering while resizing it.
My set of controls include Picture Control, Edit Boxes, Static Text, Combos, ListBox, and many more.
Can anyone help me out of this?
A sample code can be useful.
Thanks
Hitesh
I noticed a lot of flickering while resizing it.
My set of controls include Picture Control, Edit Boxes, Static Text, Combos, ListBox, and many more.
Can anyone help me out of this?
A sample code can be useful.
Thanks
Hitesh
Have you tried using LockWindowUpdate and UnlockWindowUpdate before and after the resize? Or do you need the content to be changing during the resizing?
Or CWnd::SetRedraw () can help.
Call either to block redraws during CWnd::OnSizing and (re-) allow them in CWnd::OnSize
Call either to block redraws during CWnd::OnSizing and (re-) allow them in CWnd::OnSize
have a look at the article below
http://www.codeguru.com/Cpp/misc/misc/flickerfreedrawing/article.php/c389/
http://www.codeguru.com/Cpp/misc/misc/flickerfreedrawing/article.php/c389/
ASKER
steH,
My TestApplication is a MDI App.
I do it the way you suggested.
I'm handling the event
WM_NCLBUTTONDOWN
and my code looks something like
void CChildFrame::OnNcLButtonDo wn(UINT nHitTest, CPoint point)
{
// TODO: Add your message handler code here and/or call default
LockWindowUpdate ();
CMDIChildWnd::OnNcLButtonD own(nHitTe st, point);
UnlockWindowUpdate ();
}
This does work to someextent, but I can't see the dragging Rectangle during resize the child window.
My TestApplication is a MDI App.
I do it the way you suggested.
I'm handling the event
WM_NCLBUTTONDOWN
and my code looks something like
void CChildFrame::OnNcLButtonDo
{
// TODO: Add your message handler code here and/or call default
LockWindowUpdate ();
CMDIChildWnd::OnNcLButtonD
UnlockWindowUpdate ();
}
This does work to someextent, but I can't see the dragging Rectangle during resize the child window.
I thought more of:
void CChildFrame::OnNcLButtonDo wn(UINT nHitTest, CPoint point)
{
// TODO: Add your message handler code here and/or call default
SetRedraw (FALSE); // or LockWindowUpdate ();
CMDIChildWnd::OnNcLButtonD own(nHitTe st, point);
}
void CChildFrame::OnNcLButtonUp (UINT nHitTest, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CMDIChildWnd::OnNcLButtonU p(nHitTest , point);
SetRedraw (TRUE); // or UnlockWindowUpdate ();
}
perhaps you need to add a timer which does some redraws per second (5-?) but not too many as they would normally appear. But this is just out of my head. Have not tried it yet.
void CChildFrame::OnNcLButtonDo
{
// TODO: Add your message handler code here and/or call default
SetRedraw (FALSE); // or LockWindowUpdate ();
CMDIChildWnd::OnNcLButtonD
}
void CChildFrame::OnNcLButtonUp
{
// TODO: Add your message handler code here and/or call default
CMDIChildWnd::OnNcLButtonU
SetRedraw (TRUE); // or UnlockWindowUpdate ();
}
perhaps you need to add a timer which does some redraws per second (5-?) but not too many as they would normally appear. But this is just out of my head. Have not tried it yet.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.