Solved

How to avoid flickering of controls on CFormView?

Posted on 2004-10-02
9
286 Views
Last Modified: 2013-11-20
Hi,

I have a CFormView with many controls. When I try to resize the view i.e child frame, there is a lot of flickering of all the controls. Can anyone please help to to remove this filckering of controls.

Thanks
Madhavi
0
Comment
Question by:likhita
9 Comments
 
LVL 6

Expert Comment

by:Amritpal Singh
ID: 12210533
call the following api from InitInstance

SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, false, NULL, 0);

for more info visit the link
http://www.esri.com/devsupport/devconn/mapobjects/techdocs/tutorials/mfc/cguide21.htm
0
 
LVL 11

Expert Comment

by:KurtVon
ID: 12217939
I found you can minimize flickering by overriding OnSize in the form view and adding

if (m_bInitialized)
{
    SetRedraw(FALSE);
    CFormView::OnSize(nType, cx, cy);
    SetRedraw(TRUE);
    Invalidate();
}
else
    CFormView::OnSize(nType, cx, cy);

But there isn't really a way to eliminate it completely that I've located.

m_bInitialized is set in OnInitialUpdate.
0
 
LVL 6

Expert Comment

by:nabehs
ID: 12235407
// try the following:
// override OnEraseBkgnd of the form view and write the following code:
// it should reduce the flickering dramatically

BOOL CMyFormView::OnEraseBkgnd(CDC* pDC)
{
      CRect rcBounds;
      GetClientRect(&rcBounds);

      // loop all the child windows and collect their regions
      CWnd* pwndChild = GetWindow(GW_CHILD);
      CRgn rgnResult, rgn1;
      rgnResult.CreateRectRgn(rcBounds.left, rcBounds.top, rcBounds.right, rcBounds.bottom);
      CRect rcChild;
      while (pwndChild)
      {
            pwndChild->GetClientRect(&rcChild);
            pwndChild->ClientToScreen(&rcChild);
            ScreenToClient(&rcChild);

            // subtract the control region from the dialog region
            rgn1.CreateRectRgn(rcChild.left, rcChild.top, rcChild.right, rcChild.bottom);
            rgnResult.CombineRgn(&rgnResult, &rgn1, RGN_DIFF);
            pwndChild = pwndChild->GetNextWindow();

            rgn1.DeleteObject();
      }


      // limit refresh to the resulting region
      pDC->SelectClipRgn(&rgnResult, RGN_COPY);

      BOOL bRet = CFormView::OnEraseBkgnd(pDC);

      pDC->SelectClipRgn(NULL, RGN_COPY);

      return bRet;
}
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Expert Comment

by:Masudkhan
ID: 12367290
Hello Madhavi,
Wake up. People have suggested some answers & awaiting a reply from you !!!!!!!!!!
0
 
LVL 6

Expert Comment

by:nabehs
ID: 12816600
I am using the method I have provided in my personal work and it is working fine, but I am open to any objections
0
 
LVL 6

Expert Comment

by:Amritpal Singh
ID: 12817117
i'm stuck in a way that i can't even say for a point split keeping in view the points of the question :))
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12867794
PAQed with points refunded (20)

modulo
Community Support Moderator
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
List out all word 7 223
WinWaitActive parameters 12 31
Hibernate methods 2 58
only14 challenge 19 63
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now