且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C#Win Form App字体处理自动生成的代码

更新时间:2023-09-24 22:51:28

在下面的链接中有一篇博客文章讨论类似问题:

http://blogs.msdn.com/b/ploeh/archive/2006/08/10/howtodisposemembersfromforms.aspx [ ^ ]

它描述了如何从表单中处理成员。在该帖子的评论部分,作者提供了以下代码和说明。



There is a blog post at below link discussing similar issue:
http://blogs.msdn.com/b/ploeh/archive/2006/08/10/howtodisposemembersfromforms.aspx[^]
It describes how to dispose Members From Forms. In the comments section of that post Author has provided below code with explanation.

public partial class MyForm : Form
{
    private MyDisposable myDisposable_;

    public MyForm()
    {
        InitializeComponent();

        this.myDisposable_ =
            new MyDisposable("Goodbye, World");

            this.Disposed += new EventHandler(this.OnMyFormDisposed);
    }

    void OnMyFormDisposed(object sender, EventArgs e)
    {
        this.myDisposable_.Dispose();
    }
}





下面的链接会有所帮助:



http://***.com/questions/ 1052147 / how-do-i-extend-a-winforms-dispose-method [ ^ ]



http://blogs.msdn.com/b/jfoscoding/archive/2005/08/12/450835.aspx [ ^ ]



谢谢。



further below links would be helpful:

http://***.com/questions/1052147/how-do-i-extend-a-winforms-dispose-method[^]

http://blogs.msdn.com/b/jfoscoding/archive/2005/08/12/450835.aspx[^]

Thanks.