Flicker and CreateParams

I want to avoid flickering in the panel of my application after you sent a search query from 4 months ago , after you tried subclassing the panels, after you asked here two or three times, after you asked others forums ... no one has a solution, but today I found a solution miraculously in this last answer: Is this a way to stop the image from flickering when resizing?

Protected Overrides ReadOnly Property CreateParams() As CreateParams Get Dim cp As CreateParams = MyBase.CreateParams cp.ExStyle = cp.ExStyle Or &H2000000 Return cp End Get End Property 'CreateParams 

Now I want to know what these lines of code really do. I need to understand what this code does for my application,

is a good way to avoid flickering?

MSDN says:

"The CreateParams property should not be overridden and used to configure the properties of your derived control."

but why not ?, this is the only way I found that my panel is flickering, so I want to know more about the code I wrote above, I want to understand all the orders, as well as the advantages of this sub and negatives, everything is welcome ...

Can anyone explain me more about this code?

 UPDATE: 

I tested the “flickering solution” in all my applications and yes, this is a flickering solution ... but it has a negative point, because my programs rotate -200% faster, I mean when I use this overriding sub-program, the programs become much slower, than x6 times slower, so overriding sub is not recommended, as it is.

Does anyone know if I can avoid flickering without prior notice to my application?

+4
source share
1 answer

Each time you redraw a control, you also need to redraw the background; An operation that your application might not require resources to complete. The solution you use basically sets a flag indicating that you want your form and everything that it draws to be double buffers. You can use an unnecessary amount of resources. Instead, you can set the double buffered property to true for each object that is involved in your image size. Computers have limited resources, and you should save as much as possible. It is for this reason that Microsoft has predetermined so many parameters and procedures for freeing resources.

Edit: The default PictureBox is used for buffering by default to handle the onpaint event. You still need a double buffer for background objects.

+1
source

Source: https://habr.com/ru/post/1479859/


All Articles