[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to reduce Flickering in a FormView while resizing?

Posted on 2004-11-04
9
Medium Priority
?
761 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:hitesh17
7 Comments
 
LVL 13

Expert Comment

by:SteH
ID: 12502283
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
 
LVL 13

Expert Comment

by:SteH
ID: 12502300
Or CWnd::SetRedraw () can help.
Call either to block redraws during CWnd::OnSizing and (re-) allow them in CWnd::OnSize
0
 
LVL 6

Expert Comment

by:Amritpal Singh
ID: 12502557
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:hitesh17
ID: 12503307
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
 
LVL 13

Expert Comment

by:SteH
ID: 12503500
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
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 300 total points
ID: 12504176
Try to add WS_CLIPCHILDREN style to CFormView-derived class.
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 900 total points
ID: 12595723
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month18 days, 15 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question