WebPartZoneBase.CreateControlStyle 方法

定义

创建在区域控件可见时应用于它的样式特征的集合。Creates a set of style characteristics that apply to a zone control when it is visible.

protected:
 override System::Web::UI::WebControls::Style ^ CreateControlStyle();
protected override System.Web.UI.WebControls.Style CreateControlStyle ();
override this.CreateControlStyle : unit -> System.Web.UI.WebControls.Style
Protected Overrides Function CreateControlStyle () As Style

返回

Style

包含 Style 的样式特性的 WebPartZoneBaseA Style that contains style attributes for a WebPartZoneBase.

注解

CreateControlStyle方法创建一组适用于区域的标准样式特性 WebPartZoneBaseThe CreateControlStyle method creates a set of standard style attributes that apply to WebPartZoneBase zones. 仅当页面处于显示模式(如 "目录"、"编辑" 或 "设计" 显示模式)时,样式属性才适用。The style attributes apply only when a page is in a display mode in which a zone itself is visible, such as catalog, edit, or design display mode.

继承者说明

如果重写 CreateControlStyle() 方法以在创建的样式上设置某些特定属性,请不要使用该 Style(StateBag) 版本的构造函数,这要求您将控件的 StateBag 对象作为参数传递,导致创建的 Style 对象 StateBag 与区域控件共享。If you override the CreateControlStyle() method to set some specific properties on the created style, do not use the Style(StateBag) version of the constructor, which requires you to pass the control's StateBag object in as a parameter, resulting in the created Style object sharing the StateBag with the zone control. 这会导致呈现问题。This causes rendering problems. Style() 为使用该构造函数的版本,使该 Style 对象独立于控件。Instead, use the Style() version of the constructor, so the Style object is independent of the control.

适用于