处置定制设计中的窗体或用户控件 [英] Custom Dispose in designed form or user control

查看:90
本文介绍了处置定制设计中的窗体或用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个自定义的WinForms用户控件,并想重写处置。然而,通过设计生成的代码已经包含了Dispose方法。我怎么可以添加自定义清理代码到我的组成部分?

I've created a custom WinForms UserControl and would like to override Dispose. However the code generated by the designed already contains a Dispose method. How can I add custom cleanup code to my component?

推荐答案

生成可以移动从代码Dispose方法文件到您的控制CS文件。我在.NET 2.0中使用这一点,它应该在4.0正常工作。

You can move the Dispose method from the code generated file into your control cs file. I've used this under .net 2.0, it should work on 4.0 as well.

这篇关于处置定制设计中的窗体或用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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