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. Image Flicker

Image Flicker

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
6 Posts 6 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.
  • J Offline
    J Offline
    john5632
    wrote on last edited by
    #1

    I am drwaing images on a view So I develped a owner draw control to darw images. I also need to draw blue order around on mouse hover So I am also drwing. But I am facing some flickering issue How can I reduce it?

    L F L S R 5 Replies Last reply
    0
    • J john5632

      I am drwaing images on a view So I develped a owner draw control to darw images. I also need to draw blue order around on mouse hover So I am also drwing. But I am facing some flickering issue How can I reduce it?

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      By making your paint code as swift as possible: don't create objects, don't paint more than necessary, etc. Show your code if you need detailed help. Alternatively, for rubber-banding kind of stuff, have a look at ControlPaint.DrawReversibleFrame(). Warning: it also paints outside the intended Control! :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Season's Greetings to all CPians.

      1 Reply Last reply
      0
      • J john5632

        I am drwaing images on a view So I develped a owner draw control to darw images. I also need to draw blue order around on mouse hover So I am also drwing. But I am facing some flickering issue How can I reduce it?

        F Offline
        F Offline
        followait
        wrote on last edited by
        #3

        You can try: 1. use memory dc 2. draw what is necessary

        1 Reply Last reply
        0
        • J john5632

          I am drwaing images on a view So I develped a owner draw control to darw images. I also need to draw blue order around on mouse hover So I am also drwing. But I am facing some flickering issue How can I reduce it?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You might also try handling WM_ERASEBKGND. Do nothing in the handler and return a non-zero value. This will prevent the view window being flood-filled with the window class brush color just before each call to WM_PAINT. The other key is using some double-buffering scheme. Draw your content on an off-screen bitmap and then blit that to your view, rather than drawing in the view itself.

          L u n a t i c F r i n g e

          1 Reply Last reply
          0
          • J john5632

            I am drwaing images on a view So I develped a owner draw control to darw images. I also need to draw blue order around on mouse hover So I am also drwing. But I am facing some flickering issue How can I reduce it?

            S Offline
            S Offline
            Stephen Hewitt
            wrote on last edited by
            #5

            When is the flickering occuring?

            Steve

            1 Reply Last reply
            0
            • J john5632

              I am drwaing images on a view So I develped a owner draw control to darw images. I also need to draw blue order around on mouse hover So I am also drwing. But I am facing some flickering issue How can I reduce it?

              R Offline
              R Offline
              Rozis
              wrote on last edited by
              #6

              Flicker occurs when there are intermediate pixels on the screen. Example: draw a blue,filled rectangle, then draw a non-rectangle bitmap over that. The blue pixels 'under' the bitmap cause the effect. There are 2 solutions: 1) avoid the drawing of unneeded pixels by making your algorithm better (and faster) or using regions (see winapi documentation), 2) draw everything in a buffer (memory DC) and transfer that to the screen. This is called 'double buffering'. The first solution is most of the times too difficult to implement, so solution 2 is widely used, although it is actually slower.

              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