4

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.

SharpAffair
  • 5,558
  • 13
  • 78
  • 158
  • 1
    Why are you adding/removing them? Wouldn't setting the visibility be sufficient? It sounds like you are not using the correct control for the job. – leppie Aug 10 '10 at 11:36
  • I have tried setting the visible property ,It flickers too – Thunder May 08 '12 at 13:02

2 Answers2

6

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

SharpAffair
  • 5,558
  • 13
  • 78
  • 158
  • Not ideal but if you want something done properly, do it yourself. – Matt Skeldon Jun 07 '13 at 14:44
  • @MattSkeldon what would be your ideal solution? – Smith Jan 20 '16 at 13:32
  • My ideal solution would be that the standard control works without needing to create an inherited control that totally renders the standard control pointless, as once you have done this there is no benefit to the standard control. Ideal and realistic are totally different concepts though. – Matt Skeldon Jan 21 '16 at 08:46
1

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.

xpda
  • 15,585
  • 8
  • 51
  • 82
Shekhar_Pro
  • 18,056
  • 9
  • 55
  • 79