如何在winform C#中重新打开tabcontrol的已处理选项卡 [英] How to re-open a disposed tab of a tabcontrol in winform C#

查看:407
本文介绍了如何在winform C#中重新打开tabcontrol的已处理选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在带有20个Tabs的TabControl中创建了一个包含大量控件的巨大表单。在运行时,它使用大量内存,并且在打开所有标签页时,用户对象超过了其限制10000。我想在更换标签时每次都处理最后使用的标签,但是有一个问题我们无法重新打开一个标签页。



我是什么尝试过:



i已经尝试过用户控制容器来部分加载表单控件,但它不值得......

I have created a huge form with large number of Controls in a TabControl having 20 Tabs.. In run time its using huge memory, and User Objects gets exceeded its limit of 10000 while opening all the tab pages. i want to dispose last used tab each time while changing the tab, but there is a problem we can't reopen a dispose tab..

What I have tried:

i have tried User Control Container to partially loading of form controls but its not worthy...

推荐答案

您不能重新打开Disposed类实例:它们依赖的资源已被回收。尝试就像拆除一张桌子,用腿作为木柴,顶部作为门,然后尝试在上面吃晚餐!这是行不通的:一旦桌子被回收,你需要买一个新的。

这是谁需要对你的标签页面做什么:根据需要创建新实例。



但老实说,我认为您的UI设计存在严重缺陷:我非常怀疑任何用户都希望查看10,000个控件,更不用说等待您的应用启动了up - 这可能需要相当长的时间来显示 - 我当然不会!
You cannot re-open Disposed class instances: the resources they rely upon have been recycled. Trying to is like dismantling a table, using the legs as firewood and the top as a door, then trying to serve dinner on it! That won't work: once the table has been recycled, you need to buy a new one.
Which is what who need to do with your tab pages: create new instances as needed.

But honestly, I think your UI design is badly flawed: I doubt very much that any user is going to want to look at 10,000 controls, let alone wait for your app to start up - which will probably take considerable time with that much to display - I certainly wouldn't!


这篇关于如何在winform C#中重新打开tabcontrol的已处理选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆