Login.CheckBoxStyle 屬性

定義

會得到一個物件的參考 Style ,該物件定義了「記住我」勾選框的設定。

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

屬性值

參考了定義控制項「記住我」勾選框風格設定Login的那Style個。

屬性

範例

以下程式碼範例透過設定該物件的屬性StyleCheckBoxStyle,將「記住我」勾選框的文字顏色設為藍色,字型樣式為斜體。

<%@ Page Language="C#" AutoEventWireup="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
        void Page_Load(Object sender, EventArgs e) 
        {
            Login1.CheckBoxStyle.ForeColor = System.Drawing.Color.Blue;
        }
</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">
                <CheckBoxStyle Font-Italic="True"></CheckBoxStyle>
            </asp:Login>

        </form>
    </body>
</html>
<%@ Page Language="VB" AutoEventWireup="false" %>
<!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.CheckBoxStyle.ForeColor = System.Drawing.Color.Blue
        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">
                <CheckBoxStyle Font-Italic="True"></CheckBoxStyle>
            </asp:Login>

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

備註

這個 CheckBoxStyle 屬性會得到一個物件的參考 Style ,你可以用它來改變控制項的「記住我」勾選框的 Login 外觀。

此屬性為唯讀;不過,你可以設定它回傳的物件屬性 Style 。 你可以以宣告式 Property-Subproperty的形式設定這些屬性,其中 Subproperty 表示類別 Style 的屬性(例如, CheckBoxStyle-ForeColor)。 你可以在 Form Property.Subproperty 中以程式方式設定該屬性(例如 CheckBoxStyle.ForeColor)。

常見設定包括自訂背景色、文字顏色及字型屬性。 CheckBoxStyle財產定義了房產RememberMeText的外觀。

屬性的樣式設定 CheckBoxStyle 會與控制項的樣式設定 Login 合併。 屬性中 CheckBoxStyle 的任何設定都會覆蓋控制項屬性 Login 中相應的設定。

以下 Login 控制樣式屬性會被 CheckBoxStyle 設定覆蓋:

當你用模板來定義控制項的外觀 Login 時,屬性 CheckBoxStyle 本身就沒有影響。

適用於

另請參閱