问题:“添加了
Trend.OwnerDrawCell += new Grid.OwnerDrawCellEventHandler(clsDrawLine.rdo4);
如果要清除,只有Trend.OwnerDrawCell -= new Grid.OwnerDrawCellEventHandler(clsDrawLine.rdo4);
这一种清除方法吗?还有没有别的清除方法”
有朋友这样答复:
很简单,加一个公共变量,然后在OwnerDrawCell事件中检查这个变量的值,如果为True就直接Return --- 怎样用代码具体实现呢?谢谢
Trend.OwnerDrawCell += new Grid.OwnerDrawCellEventHandler(clsDrawLine.rdo4);
如果要清除,只有Trend.OwnerDrawCell -= new Grid.OwnerDrawCellEventHandler(clsDrawLine.rdo4);
这一种清除方法吗?还有没有别的清除方法”
有朋友这样答复:
很简单,加一个公共变量,然后在OwnerDrawCell事件中检查这个变量的值,如果为True就直接Return --- 怎样用代码具体实现呢?谢谢
这种做法我直接给的评价就是 SB
事件的强引用没有去掉,其实就可以算是“内存泄漏”了。C#就是被这种自以为高明的半瓶水搞的名声这么不好。
http://blog.csdn.net/yeqi3000/article/details/8254619