Solved

How to avoid flickering of controls on CFormView?

Posted on 2004-10-02
9
310 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
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!

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Define unique primary key 9 100
unable to delete all specified values regedit 38 903
sumHeights  challenge 17 83
Is there a simple front-end menu system. 9 147
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 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