Solved

How to avoid flickering of controls on CFormView?

Posted on 2004-10-02
9
305 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 133
mixString challenge 36 131
Question regarding Copy/Paste 16 96
noX challenge 17 130
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. …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.

828 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