GDI+ doublebuffering isnt stopping flicker :(
-
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.
-
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.
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. -
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.
Try calling the
UpdateStyles
method afterwards to force the assigned styles to be reapplied to the control.
-
Try calling the
UpdateStyles
method afterwards to force the assigned styles to be reapplied to the control.