Reduce Flickering .NET FlowLayoutPanel

I clean and add a few LinkLabel to FlowLayoutPanel every couple of seconds. It works great, but the flicker is pretty noticeable. Is there any way to reduce it? I tried installing Form.DoubleBuffering, this did not help.

+3
source share
2 answers

It is controlled by creating a custom control derived from FlowLayoutPanel and setting its styles as shown below:

Public class CustomFlowLayoutPanel Inherits FlowLayoutPanel

Public Sub New()
    MyBase.New()

    SetStyle(ControlStyles.UserPaint, True)
    SetStyle(ControlStyles.AllPaintingInWmPaint, True)
    SetStyle(ControlStyles.DoubleBuffer, True)

End Sub

Final class

+5
source

SuspendLayout() , ResumeLayout() . .

+1

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


All Articles