具有大量控件的 C#/.net 表单的性能
窗体上的控件数量会影响其性能吗?如果控件被标记为不可见怎么办?如果几个控件可见,但完全被几个控件覆盖(如包含几个控件的面板),该怎么办?
我是从 3D 建模包、视频编辑软件等应用程序的角度提出这个问题的。它们有隐藏的面板、选项卡、卷展栏、动画抽屉等等。
有人做过这样的性能测试吗?考虑这个值得吗?
Does the number of controls on a form affect its performance? What if the controls are marked invisible? What if the several controls are visible, but entirely covered by only a few controls (like a panel containing a couple of controls)?
I'm asking this from a perspective of applications like 3d modeling packages, video editing software, etc. They've got hidden panels, tabs, rollouts, animated drawers and what not.
Has anyone done any such performance tests? Is considering this worthwhile?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的。在绘图之外,每个控件只需初始化它就可以使用它自己的窗口句柄。所以即使不可见或隐藏,也会影响性能。
控制类型也有影响。第三方或自定义控件有时由多个控件组成,每个控件都有自己的句柄。
通常,对控件数量的预先考虑是在可用性上下文中完成的,这通常应该有助于避免性能问题。
Yes. Outside of the drawing, each control uses it's own window handle just by initializing it. So even invisible or hidden, it will affect performance.
The type of control makes a difference too. 3rd party or custom controls will sometimes be composed of multiple controls, each having it's own handle.
Usually the up front consideration for the amount of controls is done in the usability context and that generally should help avoid performance issues.
在不进行任何性能测试的情况下,很容易说太多的控件存在性能问题,
方法将被调用(用于控制
或继承的父母
等级制度)
Without doing any performance test it's easy to say that too many controls has performance issue,
methods will be called (for control
or for parent in inheritance
hierarchy)