संपादित करें

इसके माध्यम से साझा किया गया


TitleStyle.Wrap Property

Definition

Gets or sets a value indicating whether the contents of the title bar for a part control wrap in the title bar.

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

Property Value

true if the contents of a title bar wrap in the title bar; otherwise, false. The default is false.

Examples

The following code example demonstrates the declarative use of the Wrap property. In the code for the following page, an <asp:calendar> element and an <asp:label> element appear within a zone, which gives the corresponding controls genuine Web Parts functionality at run time.

Notice that the <parttitlestyle> element, which contains several style attributes, applies to the title bars of both Web Parts controls contained within the zone. Notice also that the <parttitlestyle> element has wrap and width attributes. Because the Wrap property value is set to true, and the text in the title bars of the two controls is wider than the value assigned to the width attribute, the title bar text of each control wraps when the page is loaded in a browser.

<%@ 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>

Remarks

The TitleStyle class overrides the base Wrap property so that it can set the value to false. The TitleStyle sets the Wrap property to false, so that by default, a title bar for a part control does not allow its contents to wrap.

Applies to

See also