TitleStyle.Wrap 屬性

定義

取得或設定數值,表示組件控制項標題列的內容是否在標題列中換行。

public:
 virtual property bool Wrap { bool get(); void set(bool value); };
public override bool Wrap { get; set; }
member this.Wrap : bool with get, set
Public Overrides Property Wrap As Boolean

屬性值

Boolean

如果標題列內容在標題列中換行,則為 true,否則為 false。 預設為 false

範例

下列程式碼範例示範 屬性的 Wrap 宣告式用法。 在下列頁面的程式碼中, <asp:calendar> 元素和 <asp:label> 元素會出現在區域內,這會在執行時間提供對應的控制項正版Web 組件功能。

請注意, <parttitlestyle> 包含數個樣式屬性的 元素會套用至區域內包含Web 組件控制項的標題列。 另請注意,元素 <parttitlestyle> 具有 wrapwidth 屬性。 Wrap由於 屬性值設定 true 為 ,而且兩個控制項標題列中的文字大於指派給 width 屬性的值,所以當頁面載入瀏覽器中時,每個控制項的標題列文字都會換行。

<%@ page Language="c#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
      <asp:webpartmanager id="WebPartManager1" runat="server" />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server"
      title="Zone 1">
        <parttitlestyle 
          font-bold="true" 
          BorderWidth="2" 
          ForeColor="#3300cc" 
          wrap="true" Width="100"/>
        <partstyle
          borderwidth="1px"   
          borderstyle="Solid"  
          bordercolor="#81AAF2" />
        <zonetemplate>
          <asp:calendar 
            ID="cal1" 
            Runat="server" 
            Title="My Calendar" />
          <asp:Label id="label1" runat="server" 
            Title="A WebPart Label">
            The label control acts as a WebPart.
          </asp:Label>
          </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>
<%@ page Language="vb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
      <asp:webpartmanager id="WebPartManager1" runat="server" />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server"
      title="Zone 1">
        <parttitlestyle 
          font-bold="true" 
          BorderWidth="2" 
          ForeColor="#3300cc" 
          wrap="true" Width="100" />
        <partstyle
          borderwidth="1px"   
          borderstyle="Solid"  
          bordercolor="#81AAF2" />
        <zonetemplate>
          <asp:calendar 
            ID="cal1" 
            Runat="server" 
            Title="My Calendar" />
          <asp:Label id="label1" runat="server" 
            Title="A WebPart Label">
            The label control acts as a WebPart.
          </asp:Label>
          </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>

備註

類別 TitleStyle 會覆寫基底 Wrap 屬性,以便將值設定為 false 。 會將 TitleStyle 屬性設定 Wrapfalse ,因此根據預設,元件控制項的標題列不允許其內容換行。

適用於

另請參閱