Login.LabelStyle 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得 TableItemStyle 物件的參考,其定義了 Login 控制項標籤的設定。
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 的參考,定義 Login 控制項標籤的樣式設定。
- 屬性
範例
下列程式代碼範例會藉由設定 屬性所參考LabelStyle對象的屬性TableItemStyle,將文字框標籤設定為藍色斜體文字。
<%@ 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.LabelStyle.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">
<LabelStyle Font-Italic="True"></LabelStyle>
</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.LabelStyle.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">
<LabelStyle Font-Italic="True"></LabelStyle>
</asp:Login>
</form>
</body>
</html>
備註
屬性 LabelStyle 會定義 控件中 Login 文字框標籤的外觀。 此屬性是只讀的;不過,您可以設定其傳回之 TableItemStyle 對象的屬性。 您可以在 表單 Property-Subproperty
中宣告設定這些屬性,其中 Subproperty
代表類別的屬性 TableItemStyle (,例如, LabelStyle-ForeColor
) 。 例如, LabelStyle.ForeColor
您可以在表單Property.Subproperty
中以程式設計方式設定 屬性 () 。
常見的設定包括自定義背景色彩、文字色彩和字型屬性。 屬性 LabelStyle 會定義下列屬性的外觀:
屬性的 LabelStyle 樣式設定會與控件的 Login 樣式設定合併。 屬性中 LabelStyle 所做的任何設定會覆寫 控件屬性 Login 中的對應設定。
設定會覆寫LabelStyle下列Login樣式屬性:
當您使用範本來定義控件的外觀 Login 時, LabelStyle 屬性不會有任何作用。