Login.LoginButtonStyle 属性

定义

获取对 Style 对象的引用,该对象允许您设置 Login 控件中登录按钮的外观。

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

属性值

Style

对表示登录按钮样式的 Style 的引用。

属性

示例

下面的代码示例使用 LoginButtonStyle 属性定义控件登录按钮的外观 Login

<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
  
  protected void Page_Load(object sender, EventArgs e)
  {
    Login1.LoginButtonStyle.BorderWidth = Unit.Parse("2px");
  }
</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:Login id="Login1" 
                 runat="server">

        <LoginButtonStyle ForeColor="Red" 
                          BackColor="Silver" />

      </asp:Login>

    </form>

  </body>

</html>
<%@ Page Language="VB" AutoEventWireUp="true"%>

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

  Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs)

    Login1.LoginButtonStyle.BorderWidth = Unit.Parse("2px")
    
  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:Login id="Login1" 
                 runat="server">

        <LoginButtonStyle ForeColor="Red" 
                          BackColor="Silver" />
      </asp:Login>

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

注解

使用 LoginButtonStyle 属性控制控件中 Login 登录按钮的外观。 此属性为只读;但是,可以设置它返回的对象的属性 Style 。 可以在窗体 Property-Subproperty中以声明方式设置这些属性,其中 Subproperty 表示类 (的属性 StyleLoginButtonStyle-ForeColor 例如) 。 可以在窗体 Property.Subproperty 中以编程方式设置属性 (, LoginButtonStyle.ForeColor 例如) 。

常见设置包括自定义背景色、文本颜色和字体属性。 该 LoginButtonStyle 属性定义登录按钮的外观。

属性的 LoginButtonStyle 样式设置与控件的 Login 样式设置合并。 属性中 LoginButtonStyle 所做的任何设置都替代控件属性 Login 中的相应设置。

Login以下样式属性由LoginButtonStyle设置重写:

使用模板定义控件的外观 Login 时,该 LoginButtonStyle 属性不起作用。

适用于

另请参阅