Super slow C# custom control

后端 未结 7 688
猫巷女王i
猫巷女王i 2020-12-21 16:32

I\'ve made a custom control, it\'s a FlowLayoutPanel, into which I put a bunch of other custom controls (just Buttons, each with three Labels and a PictureBox overlayed)

相关标签:
7条回答
  • 2020-12-21 17:00

    It sounds like you seriously need to rethink your interface.

    Like others have mentioned, that number of controls on a form will not be usable.

    However I have done some experimenting looking at time to create new controls in code, even using reflection, and found that several hundred data-bound controls created on the fly in a flow-layout panel should be created in 1 to 2 seconds.

    Posting more code samples may help get a better answer.

    More info: I have just rerun my timing test again, 300 controls took 0.5 seconds, 400 took 1.9 seconds, 600 took 3 seconds, 1000 took 6 seconds.
    It seems that there is a limit somewhere between 300 and 400 where resources start to get over utilised.

    0 讨论(0)
提交回复
热议问题