WebPartManager.OnDisplayModeChanging(WebPartDisplayModeCancelEventArgs) 方法
定义
引发 DisplayModeChanging 事件,以指示 WebPartManager 控件在网页上正处于从一种显示模式切换到另一种显示模式的过程中。Raises the DisplayModeChanging event to indicate that the WebPartManager control is in the process of switching from one display mode to another on a Web page.
protected:
virtual void OnDisplayModeChanging(System::Web::UI::WebControls::WebParts::WebPartDisplayModeCancelEventArgs ^ e);
protected virtual void OnDisplayModeChanging (System.Web.UI.WebControls.WebParts.WebPartDisplayModeCancelEventArgs e);
abstract member OnDisplayModeChanging : System.Web.UI.WebControls.WebParts.WebPartDisplayModeCancelEventArgs -> unit
override this.OnDisplayModeChanging : System.Web.UI.WebControls.WebParts.WebPartDisplayModeCancelEventArgs -> unit
Protected Overridable Sub OnDisplayModeChanging (e As WebPartDisplayModeCancelEventArgs)
参数
一个 EventArgs,包含与正在更改的显示模式相关联的事件数据。An EventArgs that contains event data associated with a changing display mode.
注解
OnDisplayModeChanging其基窗体中的方法只引发 DisplayModeChanging 事件。The OnDisplayModeChanging method in its base form simply raises the DisplayModeChanging event.
继承者说明
您可以重写 OnDisplayModeChanging(WebPartDisplayModeCancelEventArgs) 方法。You can override the OnDisplayModeChanging(WebPartDisplayModeCancelEventArgs) method. 例如,在显示模式发生变化时,您可能希望使用属性) 检查新的显示模式 (, NewDisplayMode 并根据新的显示模式将在用户界面 (UI) 中更改某些内容。For example, as a display mode is changing, you might want to check what the new display mode will be (by using the NewDisplayMode property) and change something in the user interface (UI) based on what the new display mode will be. 如果有自定义的显示模式,则在自定义模式要为新的显示模式时,您可能希望使某些控件可见。If you had a custom display mode, you might want to make certain controls visible if the custom mode is going to be the new display mode.
重写此方法时,通常应调用基方法作为重写方法的第一步,以便引发事件以指示显示模式正在开始更改。When you override this method, you should normally call the base method as the first step of the overridden method, so that the event is raised to indicate a display mode is starting to change. 然后,在实际显示新的显示模式之前,您的自定义代码可以在用户界面 (UI) 中进行更改。Then, your custom code can make changes in the user interface (UI) before the new display mode is actually displayed.