gpt4 book ai didi

c# - tabControl 中选项卡的初始化

转载 作者:太空宇宙 更新时间:2023-11-03 11:06:52 25 4
gpt4 key购买 nike

我将 tabControl 与许多选项卡 (>10) 一起使用,并且每个选项卡都有 UserContol。但是选项卡在启动我的应用程序时初始化每个控件。这让我的程序太慢了。我只想在单击 userControl 时运行它。我该怎么做?

最佳答案

您应该改进您的用户控件,使它们在被激活/可见之前不会执行性能操作。 Give them a method Activate which the tabcontrol calls when the tabs becomes the selected tab.

或者,您无法将 UserControls 添加到设计器中的 TabPage 内容。而是在选项卡激活时创建您的 UserControl。但这将使它们在设计器中不可见。

关于c# - tabControl 中选项卡的初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15543284/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com