CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    25

    Help: How to get a flicker free view ?

    Hi,
    Could you help me about flicker free objects ?
    I recently filled a view with a standard color.
    Each time, when i resize the window, contents
    of view is flickering.

    Thanks for your help.

    Regards,
    Daniel



  2. #2
    Join Date
    Jun 1999
    Location
    Germany
    Posts
    343

    Re: Help: How to get a flicker free view ?

    Hello,
    you have detected one of the great Microsoft problems - but don't worry.
    Here is a raw solution:

    1) add a CBitmap and a CDC member variable in your View class.

    2) create the bitmap and the DC (e.g. in CMyView::OnCreate() )
    like this

    CClientDC dc(this);
    CDC m_DC.CreateCompatibleDC(&dc);
    m_Bmp.CreateCompatibleBitmap(&dc, 2048, 2048); // make it as big as your screen can be
    m_DC.SelectObject(&m_Bmp);




    3) Now do all your drawing into the m_DC
    4) In OnDraw, OnPaint or OnEraseBkGnd just call a BitBlt

    CRect r;
    GetClientRect(r);
    pDC->BitBlt(0,0,r.right,r.bottom,&m_DC,0,0,SRCCOPY);




    I hope this will help you.

    If not, and you want it, i can send you a whole example.

    Good luck
    Gerd


  3. #3
    Join Date
    May 1999
    Posts
    25

    Re: Help: How to get a flicker free view ?

    Thanks for your help !
    But sorry, at my view it doesn't work !
    Now, I will provide detailed information
    about my application:

    1) In the desktop properties of Windows NT4.0
    "Show window contents while dragging" is on.

    2) I tried as simple as I could. The following
    project: SDI - application with a simple CMyFormView that includes only three buttons.

    3) In OnCreate of CFormView derived class CMyFormView, the following code is included:
    -------------------------------------------------
    CClientDC dc(this);
    m_DC.CreateCompatibleDC(&dc);
    m_Bmp.CreateCompatibleBitmap(&dc, 2048, 2048);
    m_DC.SelectObject(&m_Bmp);
    (In header declaration: CDC m_DC; CBitmap m_Bmp)
    ...like your example !

    4) In OnDraw, the following code is included:
    CRect rcOverview;
    GetClientRect(rcOverview);
    pDC->BitBlt0,0,rcOverview.right,
    rcOverview.bottom,&m_DC,0,0,SRCCOPY);
    ...like your example !

    If I resize the window, the formview contents incl. buttons are flickering tremendous!

    Could you help me about this problem again ?

    Thank you very much indeed.

    Best Regards,
    Daniel



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured