我如何以C#MDI形式减少这些GDI和User对象 [英] how can i reduce these GDI and User objects in C# mdi form

查看:177
本文介绍了我如何以C#MDI形式减少这些GDI和User对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,
我正在开发.Net3.5 Windows应用程序.该项目是为呼叫中心人员设计的.当有电话要尝试提供一些数据时,GDI对象和用户对象不断增加.我打了100次电话后,GDI和User对象范围将大于4000,因此当时应用程序无法正常工作.

因此,如何减少MDI形式的这些GDI和用户对象

Dear all,
I am working on .Net3.5 windows application.The project is for call center people.While calls are coming and attempting to give some data, the GDI objects and user objects are continuously increasing.After i made 100 calls the GDI and User objects range will be greater than 4000 so at that time application is not working.

So how can i reduce these GDI and User objects in MDI form

推荐答案

那就像在问:我怎么能花更少的钱?".

没有关于购买的东西(您使用GDI对象的用途)以及如何购买它们(如何使用GDI对象)的更好得多的想法,以及您正在花费的东西的使用方式(您的用户如何使用您的应用程序)没有答案有任何意义.
That is like asking: "How can I spend less money?".

Without a much, much better idea of what you are buying (what you are using GDI objects for) and how you are buying them (how you are using your GDI objects), combined with how the things you are spending on are being used (how your users use your application) no answer has any meaning.


许多GDI类都实现了接口IDisposable,必须加以处理.对于这些对象,处置是处置非托管资源的重要机制.可能是,您这样做失败并造成了良好的资源泄漏.检查您的应用程序是否实现了此接口的所有类,并确保在使用它们后将它们正确处理.

特别是,通过堆栈变量获取实例类并将其处置以供临时使用的正确方法是使用"语句.请参阅 http://msdn.microsoft.com/en-us/library/yh598w02.aspx [ ^ ].此构造确保即使在块内抛出异常,也自动在"using"块的出口处自动调用IDisposable.Dispose.

其他建议:不要折磨自己并排斥所有用户-切勿使用MDI.
请参阅:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages [在WPF中使用MDI窗口的问题 [ ^ ],
提供错误的MDIContainer [
Many of the GDI classes implement the interface IDisposable and have to be disposed. For these objects, disposing is important mechanism for disposing of the unmanaged resources. Chances are, you failed to do it and created a good resource leak. Examine your application for all the classes which implement this interface and makes sure they are properly disposed after they are used.

In particular, right way for obtaining class instanced and disposing them for temporary use via a stack variable is "using" statement. See http://msdn.microsoft.com/en-us/library/yh598w02.aspx[^]. This construct makes sure IDisposable.Dispose is called automatically at the exit from "using" block even if exception was thrown inside the block.

Additional advice: don''t torture yourself and repel all your users — never use MDI.
Please see:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^].

—SA


通常:
1.清除您目前不需要的对象.
2.重复使用本应经常重新创建的系统资源.

特别是:
您能否给出创建和处理累积对象的代码示例?否则,很难说出该怎么做.
In general:
1. Get rid of objects you don''t need at the moment.
2. Re-use system resources that you would otherwise re-create frequently.

In particular:
Can you give a code sample of creation and disposal of your accumulating objects? Otherwise it''s hard to tell what can be done.


这篇关于我如何以C#MDI形式减少这些GDI和User对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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