PasswordRecovery.LabelStyle 屬性

定義

取得定義 PasswordRecovery 控制項中文字方塊標籤外觀之樣式屬性集合的參考。

public:
 property System::Web::UI::WebControls::TableItemStyle ^ LabelStyle { System::Web::UI::WebControls::TableItemStyle ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.TableItemStyle LabelStyle { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.LabelStyle : System.Web.UI.WebControls.TableItemStyle
Public ReadOnly Property LabelStyle As TableItemStyle

屬性值

TableItemStyle

TableItemStyle 的參考,包含了定義文字方塊標籤外觀的屬性。

屬性

範例

下列程式碼範例會 LabelStyle 使用 屬性來變更 控制項中的 PasswordRecovery 文字方塊標籤外觀。

<%@ 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>
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="form1" runat="server">
    <asp:PasswordRecovery id="PasswordRecovery1" runat="server" 
      AnswerLabelText="Your answer:" 
      QuestionLabelText="Answer this question:" 
      UserNameLabelText="Your user name:">
      <LabelStyle 
        font-bold="True" 
        forecolor="White"
        backcolor="Navy">
      </LabelStyle>
    </asp:PasswordRecovery>
  </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>
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="form1" runat="server">
    <asp:PasswordRecovery id="PasswordRecovery1" runat="server" 
      UserNameLabelText="Your user name:" 
      QuestionLabelText="Answer this question:" 
      AnswerLabelText="Your answer:">
      <LabelStyle 
        font-bold="True" 
        forecolor="White"
        backcolor="Navy">
      </LabelStyle>
    </asp:PasswordRecovery>
  </form>
</body>
</html>

備註

屬性 LabelStyle 會定義 控制項中 PasswordRecovery 文字方塊標籤的外觀。 此屬性是唯讀的;不過,您可以設定它所傳回之 Style 物件的屬性。 您可以宣告方式在 格式 Property-Subproperty 中設定這些屬性,其中 Subproperty 代表類別的屬性 Style (例如, LabelStyle-ForeColor) 。 您也可以以程式設計方式在表單 Property.Subproperty 中設定屬性,例如 () LabelStyle.ForeColor

一般設定包括自訂背景色彩、文字色彩和字型屬性。

屬性 LabelStyle 會定義下列屬性的外觀:

對 屬性所做的 LabelStyle 樣式設定會與控制項的 PasswordRecovery 樣式設定合併。 屬性中 LabelStyle 所做的任何設定會覆寫 控制項屬性 PasswordRecovery 中的對應設定。

設定會覆寫 LabelStyle 下列 PasswordRecovery 屬性:

當您使用範本來定義控制項的 UserName 檢視和問題檢視的外觀 PasswordRecovery 時, LabelStyle 屬性沒有任何作用。

適用於

另請參閱