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#
  4. GDI+ doublebuffering isnt stopping flicker :(

GDI+ doublebuffering isnt stopping flicker :(

Scheduled Pinned Locked Moved C#
graphicswinformsgame-devdata-structuresperformance
4 Posts 3 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
    JDUK
    wrote on last edited by
    #1

    I have added this lines as recormended to InitializeComponent() this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint,true); What i am doing is reading an array in memory with a reference to locations on an image. I then draw the source image to a bitmap then clone the needed area(described in the array element) to a second bitmap then draw that to a onto a panel on a form. The program is a graphical level editor for a 2D tile engine based game and it works fine except when i scroll around the level editor window the image redraw looks horrible even with the double buffering enabled. Any advice? Thanks in advance, James.

    J S 2 Replies Last reply
    0
    • J JDUK

      I have added this lines as recormended to InitializeComponent() this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint,true); What i am doing is reading an array in memory with a reference to locations on an image. I then draw the source image to a bitmap then clone the needed area(described in the array element) to a second bitmap then draw that to a onto a panel on a form. The program is a graphical level editor for a 2D tile engine based game and it works fine except when i scroll around the level editor window the image redraw looks horrible even with the double buffering enabled. Any advice? Thanks in advance, James.

      J Offline
      J Offline
      John Fisher
      wrote on last edited by
      #2

      Try it this way: this.SetStyle(ControlStyles.DoubleBuffer, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); John
      "You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.

      1 Reply Last reply
      0
      • J JDUK

        I have added this lines as recormended to InitializeComponent() this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint,true); What i am doing is reading an array in memory with a reference to locations on an image. I then draw the source image to a bitmap then clone the needed area(described in the array element) to a second bitmap then draw that to a onto a panel on a form. The program is a graphical level editor for a 2D tile engine based game and it works fine except when i scroll around the level editor window the image redraw looks horrible even with the double buffering enabled. Any advice? Thanks in advance, James.

        S Offline
        S Offline
        Stefan Troschuetz
        wrote on last edited by
        #3

        Try calling the UpdateStyles method afterwards to force the assigned styles to be reapplied to the control.


        www.troschuetz.de

        J 1 Reply Last reply
        0
        • S Stefan Troschuetz

          Try calling the UpdateStyles method afterwards to force the assigned styles to be reapplied to the control.


          www.troschuetz.de

          J Offline
          J Offline
          JDUK
          wrote on last edited by
          #4

          Thanks guys tried both of those and no joy :(

          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