Link to home
Start Free TrialLog in
Avatar of hitesh17
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
Avatar of Member_2_1001466
Member_2_1001466

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
Avatar of hitesh17

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::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
      // TODO: Add your message handler code here and/or call default
      LockWindowUpdate ();
      CMDIChildWnd::OnNcLButtonDown(nHitTest, point);
      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::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
     // TODO: Add your message handler code here and/or call default
     SetRedraw (FALSE); // or LockWindowUpdate ();
     CMDIChildWnd::OnNcLButtonDown(nHitTest, point);
}

void CChildFrame::OnNcLButtonUp(UINT nHitTest, CPoint point)
{
     // TODO: Add your message handler code here and/or call default
     CMDIChildWnd::OnNcLButtonUp(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.

SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial