示例#1
0
        public override void BeforeDispose()
        {
            if (DrawOrderChanged != null)
            {
                //Remove all Events associated to this control (That haven't been unsubscribed !)
                foreach (Delegate d in DrawOrderChanged.GetInvocationList())
                {
                    DrawOrderChanged -= (EventHandler <EventArgs>)d;
                }
            }

            if (VisibleChanged != null)
            {
                //Remove all Events associated to this control (That haven't been unsubscribed !)
                foreach (Delegate d in VisibleChanged.GetInvocationList())
                {
                    VisibleChanged -= (EventHandler <EventArgs>)d;
                }
            }
        }