Part.ChromeType Proprietà

Definizione

Ottiene o imposta il tipo di bordo che delimita un controllo Web part.Gets or sets the type of border that frames a Web Parts control.

public:
 virtual property System::Web::UI::WebControls::WebParts::PartChromeType ChromeType { System::Web::UI::WebControls::WebParts::PartChromeType get(); void set(System::Web::UI::WebControls::WebParts::PartChromeType value); };
public virtual System.Web.UI.WebControls.WebParts.PartChromeType ChromeType { get; set; }
member this.ChromeType : System.Web.UI.WebControls.WebParts.PartChromeType with get, set
Public Overridable Property ChromeType As PartChromeType

Valore della proprietà

Uno dei valori PartChromeType.One of the PartChromeType values. Il valore predefinito è Default.The default is Default.

Eccezioni

Il valore non appartiene all'enumerazione PartChromeType.The value is not one of the PartChromeType values.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso dichiarativo della proprietà ChromeType in un controllo parte.The following code example illustrates the declarative use of the ChromeType property in a part control. Questo esempio richiede l'TextDisplayWebPartdi controllo WebPart personalizzato, disponibile nella sezione esempio del riepilogo della classe Part.This example requires the custom WebPart control TextDisplayWebPart, which can be found in the Example section of the Part class summary.

Nel codice dichiarativo per la pagina Web, la seconda istanza del controllo TextDisplayWebPart imposta la relativa proprietà ChromeType in modo che includa solo un titolo, mentre la prima istanza ha un titolo e un bordo.In the declarative code for the Web page, the second instance of the TextDisplayWebPart control sets its ChromeType property to have only a title, whereas the first instance has a title and a border. Una volta caricata la pagina in un browser, la seconda istanza del controllo viene visualizzata a icona ridotta a icona.After you load the page in a browser, the second instance of the control appears minimized. Se si ingrandisce il controllo, viene visualizzato un titolo senza bordo.If you maximize the control, it shows a title without a border.

<%@ page language="C#" %>
<%@ register tagprefix="aspSample" 
             Namespace="Samples.AspNet.CS.Controls" 
             Assembly="TextDisplayWebPartCS" %>

<!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"
      backcolor="#99cccc">
        <parttitlestyle font-bold="true" forecolor="#ffffff" />
        <partstyle
          borderwidth="1px" 
          borderstyle="Solid" 
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text Content WebPart" 
            Description="A text content WebPart control."
            ChromeType="TitleAndBorder"
            width="350px" />
        </zonetemplate>
    </asp:webpartzone>
    <asp:webpartzone
      id="WebPartZone2"
      runat="server"
      backcolor="#99cccc">
        <parttitlestyle font-bold="true" forecolor="#ffffff" />
        <partstyle
          borderwidth="1px" 
          borderstyle="Solid" 
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart2" 
            title = "Text Content WebPart 2" 
            Description="A text content WebPart control."
            ChromeType="TitleOnly"
            ChromeState="Minimized"
            width="350px" />
        </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>
<%@ page language="VB" %>
<%@ register tagprefix="aspSample" 
             Namespace="Samples.AspNet.VB.Controls" 
             Assembly="TextDisplayWebPartVB" %>

<!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"
      backcolor="#99cccc">
        <parttitlestyle font-bold="true" forecolor="#ffffff" />
        <partstyle
          borderwidth="1px" 
          borderstyle="Solid" 
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text Content WebPart" 
            Description="A text content WebPart control."
            ChromeType="TitleAndBorder"
            width="350px" />
        </zonetemplate>
    </asp:webpartzone>
    <asp:webpartzone
      id="WebPartZone2"
      runat="server"
      backcolor="#99cccc">
        <parttitlestyle font-bold="true" forecolor="#ffffff" />
        <partstyle
          borderwidth="1px" 
          borderstyle="Solid" 
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart2" 
            title = "Text Content WebPart 2" 
            Description="A text content WebPart control."
            ChromeType="TitleOnly"
            ChromeState="Minimized"
            width="350px" />
        </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>

Commenti

La proprietà ChromeType di un controllo parte determina il tipo di bordo che racchiude il controllo.A part control's ChromeType property determines what kind of border surrounds the control. Le opzioni includono Mostra solo un titolo, solo un bordo, un titolo e un bordo, né l'opzione predefinita, che usa semplicemente il valore della proprietà PartChromeType.Options include showing a title only, a border only, a title and border, neither, or the default option, which simply uses the value of the PartChromeType property.

Note per gli eredi

Le classi derivate come WebPart possono eseguire l'override di ChromeType per consentire la personalizzazione dell'utente del tipo di bordo che incornicia un controllo.Derived classes such as WebPart can override ChromeType to enable user personalization of the kind of border that frames a control.

Si applica a

Vedi anche