Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to avoid flickering of controls on CFormView?

Posted on 2004-10-02
9
Medium Priority
?
316 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

715 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