WebPartZoneBase.BorderWidth 属性

定义

获取或设置环绕 WebPartZoneBase 控件的边框的宽度。Gets or sets the width of the border that surrounds a WebPartZoneBase control.

public:
 virtual property System::Web::UI::WebControls::Unit BorderWidth { System::Web::UI::WebControls::Unit get(); void set(System::Web::UI::WebControls::Unit value); };
public override System.Web.UI.WebControls.Unit BorderWidth { get; set; }
member this.BorderWidth : System.Web.UI.WebControls.Unit with get, set
Public Overrides Property BorderWidth As Unit

属性值

环绕区域的边框的宽度(以指定的 Unit 为单位)。The width in the specified Unit of the border that surrounds a zone. 默认值为 1。The default is 1.

示例

下面的代码示例演示了 WebPartZone 控件上 BorderWidth 属性的声明性用法。The following code example demonstrates the declarative use of the BorderWidth property on a WebPartZone control. 有关完整的代码示例,包括代码隐藏源文件和包含此代码中区域的 .aspx 页面,请参阅 WebPartZoneBase 类概述。For the full code example, including the code-behind source file and the .aspx page that contains the zone in this code, see the WebPartZoneBase class overview.

请注意,BorderWidth 特性值设置为特定的宽度(以像素为单位)。Notice that the BorderWidth attribute value is set to a specific width in pixels. 将页面加载到浏览器并将页面切换到设计显示模式后,可以看到属性的效果。After you load the page into a browser and switch the page into design display mode, you can see the effect of the property.

<asp:WebPartZone 
  ID="WebPartZone2"
  Runat="server" 
  DragHighlightColor="#00ff00"
  AllowLayoutChange="true"
  EmptyZoneText="Add WebParts to this empty Zone."
  BorderWidth="2"
  BorderColor="DarkBlue"
  BorderStyle="Dashed" 
  MenuLabelText="Verbs Menu" 
  MenuPopupImageUrl="label.gif" >
  <VerbStyle Font-Italic="true" />
  <MenuLabelStyle BackColor="Lime" BorderWidth="1"  />
  <MenuLabelHoverStyle Font-Bold="true" />
  <MenuVerbHoverStyle BackColor="LightGrey" />
  <MenuVerbStyle Font-Italic="true" /> 
  <ZoneTemplate>
    <asp:Label ID="Label1" Runat="server" Title="Date" />
  </ZoneTemplate>
</asp:WebPartZone>
<asp:WebPartZone 
  ID="WebPartZone2"
  Runat="server" 
  DragHighlightColor="#00ff00"
  AllowLayoutChange="true"
  EmptyZoneText="Add WebParts to this empty Zone."
  BorderWidth="2"
  BorderColor="DarkBlue"
  BorderStyle="Dashed" 
  MenuLabelText="Verbs Menu" 
  MenuPopupImageUrl="label.gif" >
  <VerbStyle Font-Italic="true" />
  <MenuLabelStyle BackColor="Lime" BorderWidth="1"  />
  <MenuLabelHoverStyle Font-Bold="true" />
  <MenuVerbHoverStyle BackColor="LightGrey" />
  <MenuVerbStyle Font-Italic="true" /> 
  <ZoneTemplate>
    <asp:Label ID="Label1" Runat="server" Title="Date" />
  </ZoneTemplate>
</asp:WebPartZone>

注解

基本 BorderWidth 属性被 WebPartZoneBase 类重写以设置区域的默认边框宽度。The base BorderWidth property is overridden by the WebPartZoneBase class to set the default border width for zones.

可以通过声明方式或以编程方式设置 WebPartZoneBase 控件的 BorderWidth 属性。You can set the BorderWidth property for a WebPartZoneBase control either declaratively or programmatically. 仅当区域处于显示 WebPartZoneBase 类用户界面(UI)功能(如 EditDisplayModeDesignDisplayMode)的页面显示模式时,才会显示边框。The border appears only when the zone is in a page display mode in which WebPartZoneBase class user interface (UI) features are visible, such as EditDisplayMode or DesignDisplayMode.

适用于

另请参阅