Component.CanRaiseEvents Component.CanRaiseEvents Component.CanRaiseEvents Component.CanRaiseEvents Property

定义

获取一个指示组件是否可以引发事件的值。Gets a value indicating whether the component can raise an event.

protected:
 virtual property bool CanRaiseEvents { bool get(); };
protected virtual bool CanRaiseEvents { get; }
member this.CanRaiseEvents : bool
Protected Overridable ReadOnly Property CanRaiseEvents As Boolean

属性值

如果组件可以引发事件,则为 true;否则为 falsetrue if the component can raise events; otherwise, false. 默认值为 trueThe default is true.

注解

此属性的默认实现始终返回trueThe default implementation of this property always returns true. 继承的类Component类应重写此属性提供的功能,若要禁用事件的引发。Classes that inherit from the Component class should override this property to provide the ability to disable the raising of events. 例如,在Control类中,如果控件承载 ActiveX 控件,作为CanRaiseEvents属性返回false如果 ActiveX 控件具有冻结其事件。For example, in the Control class, if the control is being hosted as an ActiveX control, the CanRaiseEvents property returns false if the ActiveX control has its events frozen.

继承者说明

如果重写此方法在派生类中的并将其更改为返回false,则EventHandlerList返回的集合Events属性返回null的事件。If you override this method in a deriving class and change it to return false, the EventHandlerList collection returned by the Events property returns null for an event. 事件仍可以添加和从集合中,但该集合中删除Item[Object]属性将始终返回nullEvents can still be added and removed from the collection, but the collection's Item[Object] property will always return null.

适用于

另请参阅