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 中的相应设置。

PasswordRecovery以下属性由LabelStyle设置重写:

使用模板定义控件的 UserName 视图和问题视图的外观 PasswordRecovery 时,该 LabelStyle 属性无效。

适用于

另请参阅