PasswordRecovery.TitleTextStyle 属性

定义

获取对样式属性集合的引用,这些属性定义 PasswordRecovery 控件中显示的标题文本的外观。

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

属性值

TableItemStyle(包含定义 PasswordRecovery 控件中标题文本外观的属性)的引用。

属性

示例

下面的代码示例使用 TitleTextStyle 属性更改 和 QuestionTitleText 属性的外观UserNameTitleText

<%@ page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  void PasswordRecovery1_UserLookupError(object sender, EventArgs e)
  {
    PasswordRecovery1.UserNameTitleText = "Try again";
    PasswordRecovery1.TitleTextStyle.ForeColor = System.Drawing.Color.Red;
  }
  
  void PasswordRecovery1_AnswerLookupError(object sender, EventArgs e)
  {
    PasswordRecovery1.QuestionTitleText = "Try again";
    PasswordRecovery1.TitleTextStyle.ForeColor = System.Drawing.Color.Red;
  }
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
  <asp:passwordrecovery id="PasswordRecovery1" runat="server" 
    questiontitletext="Password Confirmation Question"
    usernametitletext="Get a new password" OnUserLookupError="PasswordRecovery1_UserLookupError" OnAnswerLookupError="PasswordRecovery1_AnswerLookupError">
    <titletextstyle 
      font-names="Arial" 
      font-bold="True" 
      forecolor="White" 
      backcolor="Gray">
    </titletextstyle>
  </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">
<script runat="server">

  
  Sub PasswordRecovery1_UserLookupError(ByVal sender As Object, ByVal e As System.EventArgs)
    PasswordRecovery1.UserNameTitleText = "Try again"
    PasswordRecovery1.TitleTextStyle.ForeColor = System.Drawing.Color.Red
  End Sub
  
  Sub PasswordRecovery1_AnswerLookupError(ByVal sender As Object, ByVal e As System.EventArgs)
    PasswordRecovery1.QuestionTitleText = "Try again"
    PasswordRecovery1.TitleTextStyle.ForeColor = System.Drawing.Color.Red
  End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
  <asp:passwordrecovery id="PasswordRecovery1" runat="server" 
    questiontitletext="Password Confirmation Question"
    usernametitletext="Get a new password" OnUserLookupError="PasswordRecovery1_UserLookupError" OnAnswerLookupError="PasswordRecovery1_AnswerLookupError">
    <titletextstyle 
      font-names="Arial" 
      font-bold="True" 
      forecolor="White" 
      backcolor="Gray">
    </titletextstyle>
  </asp:passwordrecovery>

</form>
</body>
</html>

注解

属性 TitleTextStyle 定义控件中 PasswordRecovery 视图标题文本的外观。 此属性是只读的;但是,可以设置它返回的对象 Style 的属性。 可以在 窗体 Property-Subproperty中以声明方式设置这些属性,其中 Subproperty 表示 Style 类 (例如 TitleTextStyle-ForeColor) 的属性。 还可以以编程方式在窗体 Property.Subproperty 中 (设置属性, TitleTextStyle.ForeColor 例如,) 。

常见设置包括自定义背景色、文本颜色和字体属性。

属性的 TitleTextStyle 样式设置与控件的样式设置 PasswordRecovery 合并。 在 属性中 TitleTextStyle 所做的任何设置都覆盖控件属性 PasswordRecovery 中的相应设置。

设置将重写TitleTextStyle以下PasswordRecovery属性:

使用模板定义控件的外观 PasswordRecovery 时, TitleTextStyle 属性不起作用。

适用于

另请参阅