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
LVL 1
hitesh17Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SteHCommented:
Have you tried using LockWindowUpdate and UnlockWindowUpdate before and after the resize? Or do you need the content to be changing during the resizing?
0
SteHCommented:
Or CWnd::SetRedraw () can help.
Call either to block redraws during CWnd::OnSizing and (re-) allow them in CWnd::OnSize
0
Amritpal SinghCommented:
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

hitesh17Author Commented:
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.
0
SteHCommented:
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.

0
AlexFMCommented:
Try to add WS_CLIPCHILDREN style to CFormView-derived class.
0
ZoppoCommented:
Hi ...


remove class styles CS_HREDRAW | CS_VREDRAW from the frame window's class (CChildFrm for MDI, CMainFrame for SDI), i.e.
...::OnCreate(...)
{
 ...
 SetClassLong( m_hWnd, GCL_STYLE, GetClassLong( m_hWnd, GCL_STYLE ) & ~( CS_HREDRAW | CS_VREDRAW ));

 return 0;
}

Maybe even the view itself has these styles set ... check this out using Spy++ ... if so use the same function to remove these styles there.

These styles control to 'Redraws the entire window if a movement or size adjustment changes the height/width of the client area.'

Hope that helps,

ZOPPO
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.