如何提高Windows窗体设计器在大窗体中的性能?
在我工作的地方,我发现一个具有大表单的应用程序,其中有一个选项卡控件和 14 个选项卡页,每个选项卡页都有很多彼此重叠的控件和面板,这使得 Windows 窗体设计器非常慢。保存需要 1 分钟,更改选项卡页面和更改文本框属性需要 10 秒以上。
我尝试以较小的形式分离选项卡页,并将这些形式称为选项卡页的子级,以创建选项卡页处于同一形式的错觉,但这不起作用,因为当我将表单加载到选项卡页中时,所有尺寸而且位置都乱了。
有没有一种方法可以提高 Windows 窗体设计器的性能而不彻底改变应用程序的工作方式?
Where i'm working i have found an application with a big form that has a tabcontrol and 14 tabpages, every tabpage has a lot of controls and panels that overlap each other, this makes windows form designer really slow. It takes 1 minute to save and over 10 seconds to change a tabpage and change a textbox property.
I tried to separate the tabpages in smaller forms and call the forms as children of a tabpage to create the illusion of the tabpages being in the same form, but that didn't work, because when i load the form into a tabpage then all sizes and locations are messed up.
There is a way to improve the performance of the windows form designer without changing drastically the way the application works?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建 14 个 UserControls 并调整选项卡控件的大小以仅显示选项卡header 并在选项卡控件下方放置一个
Panel
作为占位符。然后,当选择选项卡页时,动态地将用户控件之一添加到面板,并将停靠设置为Fill
。当然,您需要添加代码来在用户控件更改时加载和保存值或设置数据绑定 来源。
但如果你说保存需要1分钟,那么你的保存过程可能不是最优的。
Create 14 UserControls and resize the tab control to only show the tabs header and place a
Panel
as placeholder below the tab control. Then when a tab page is selected dynamically add one of the user controls to the panel with docking set toFill
.Of course you will have add code to load and save values when the user control changes or to set the Data Binding source.
But if you say that it takes 1 minute to save, then maybe your saving procedure is suboptimal.