Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Why I shoun't call CView::OnPaint() for painting messages

Why I shoun't call CView::OnPaint() for painting messages

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    assay
    wrote on last edited by
    #1

    Hi Why at the end of the OnPaint() there is a comment saying: // Do not call CView::OnPaint() for painting messages ? what should i do for refreshing the window, i try to call the function Invalidate() but when I call it the screen blinks. Please advice. Regards Assay.

    T 1 Reply Last reply
    0
    • A assay

      Hi Why at the end of the OnPaint() there is a comment saying: // Do not call CView::OnPaint() for painting messages ? what should i do for refreshing the window, i try to call the function Invalidate() but when I call it the screen blinks. Please advice. Regards Assay.

      T Offline
      T Offline
      Themis
      wrote on last edited by
      #2

      In order to avoid blinkings try to invalidate only the area you are updating instead of the whole paint area. Themis

      A 1 Reply Last reply
      0
      • T Themis

        In order to avoid blinkings try to invalidate only the area you are updating instead of the whole paint area. Themis

        A Offline
        A Offline
        assay
        wrote on last edited by
        #3

        How do i do that?

        T 1 Reply Last reply
        0
        • A assay

          How do i do that?

          T Offline
          T Offline
          Themis
          wrote on last edited by
          #4

          It's easy if you know what you have updated in each call. Instead of calling Invalidate() call InvalidateRect(). It takes as argument the area that you want to invalidate. It will update only that area this way if only a small portion of your view has changed you won't redraw everything. Themis

          A 1 Reply Last reply
          0
          • T Themis

            It's easy if you know what you have updated in each call. Instead of calling Invalidate() call InvalidateRect(). It takes as argument the area that you want to invalidate. It will update only that area this way if only a small portion of your view has changed you won't redraw everything. Themis

            A Offline
            A Offline
            assay
            wrote on last edited by
            #5

            Many thanks ! Do you know about more methods for redrawing the window except for calling the Onpaint()?

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups