Reduce Flicker of .NET FlowLayoutPanel

╄→尐↘猪︶ㄣ 提交于 2020-01-14 19:20:30

问题


I'm clearing and adding multiple LinkLabel's to FlowLayoutPanel, every couple of seconds. It works fine, but flicker is quite noticeable. Is there any way to reduce it? I tried to set Form.DoubleBuffering, it didn't help.


回答1:


Managed 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

End Class




回答2:


Try calling SuspendLayout() for the panel before adding controls to it and then call ResumeLayout() on the Panel. You may lose that flicker a bit.



来源:https://stackoverflow.com/questions/3448444/reduce-flicker-of-net-flowlayoutpanel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!