Style 類別
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
警告
The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.
組織 ASP.NET 行動控制項的樣式特性。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。
public ref class Style : ICloneable, System::Web::UI::IParserAccessor, System::Web::UI::IStateManager, System::Web::UI::MobileControls::ITemplateable
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
public class Style : ICloneable, System.Web.UI.IParserAccessor, System.Web.UI.IStateManager, System.Web.UI.MobileControls.ITemplateable
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
[System.Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
public class Style : ICloneable, System.Web.UI.IParserAccessor, System.Web.UI.IStateManager, System.Web.UI.MobileControls.ITemplateable
[<System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))>]
type Style = class
interface IParserAccessor
interface ITemplateable
interface IStateManager
interface ICloneable
[<System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))>]
[<System.Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")>]
type Style = class
interface IParserAccessor
interface ITemplateable
interface IStateManager
interface ICloneable
Public Class Style
Implements ICloneable, IParserAccessor, IStateManager, ITemplateable
- 繼承
-
Style
- 衍生
- 屬性
- 實作
下列範例示範物件中的三個 StyleSheet 用戶定義樣式。
SelectionList物件會保存三個對應至三個已定義樣式的值。
OnClick
命令事件會呼叫 SelectStyle
函式,以變更 StyleReference 對象的屬性TextView。
<%@ Page Language="C#"
Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile"
Namespace="System.Web.UI.MobileControls"
Assembly="System.Web.Mobile" %>
<script runat="server">
void SelectStyle(object sender, EventArgs e)
{
// Retrieve the style name as a string.
String myStyle = SelectionList1.Selection.ToString();
// Match the style name and apply the style to TextView1.
switch (myStyle)
{
case "hot":
TextView1.StyleReference = "Style1";
break;
case "medium":
TextView1.StyleReference = "Style2";
break;
case "mild":
TextView1.StyleReference = "Style3";
break;
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<mobile:StyleSheet id="StyleSheet1" runat="server">
<mobile:Style font-size="Large" font-name="Arial" font-bold="true"
forecolor="red" font-italic="true" backcolor="#E0E0E0"
wrapping="wrap" name="Style1">
</mobile:Style>
<mobile:Style font-size="Normal" font-name="Arial" font-bold="false"
forecolor="Blue" font-italic="true" backcolor="blue"
wrapping="NoWrap" name="Style2">
</mobile:Style>
<mobile:Style font-size="Small" font-name="Arial Narrow"
font-bold="false" forecolor="Green" font-italic="false"
backcolor="Green" wrapping="NoWrap" name="Style3">
</mobile:Style>
</mobile:StyleSheet>
<mobile:form id="Form1" runat="server">
<mobile:Label id="Label1" runat="server" Text="Today's Special"
StyleReference="title" />
<mobile:TextView id="TextView1" runat="server"
StyleReference="Style1">
Chili
</mobile:TextView>
<mobile:SelectionList runat="server" id="SelectionList1">
<item Text="hot" Value="hot"/>
<item Text="medium" Value="medium"/>
<item Text="mild" Value="mild"/>
</mobile:SelectionList>
<mobile:Command runat="server" Text="Select Style"
OnClick="SelectStyle" />
</mobile:form>
</body>
</html>
<%@ Page Language="VB"
Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile"
Namespace="System.Web.UI.MobileControls"
Assembly="System.Web.Mobile" %>
<script runat="server">
Private Sub SelectStyle(ByVal sender As Object, _
ByVal e As EventArgs)
' Retrieve the style name as a string
Dim myStyle As String = SelectionList1.Selection.ToString()
' Match the style name and apply the style to TextView1
Select Case myStyle
Case "hot"
TextView1.StyleReference = "Style1"
Case "medium"
TextView1.StyleReference = "Style2"
Case "mild"
TextView1.StyleReference = "Style3"
End Select
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<mobile:StyleSheet id="StyleSheet1" runat="server">
<mobile:Style font-size="Large" font-name="Arial" font-bold="true"
forecolor="red" font-italic="true" backcolor="#E0E0E0"
wrapping="wrap" name="Style1">
</mobile:Style>
<mobile:Style font-size="Normal" font-name="Arial" font-bold="false"
forecolor="Blue" font-italic="true" backcolor="blue"
wrapping="NoWrap" name="Style2">
</mobile:Style>
<mobile:Style font-size="Small" font-name="Arial Narrow"
font-bold="false" forecolor="Green" font-italic="false"
backcolor="Green" wrapping="NoWrap" name="Style3">
</mobile:Style>
</mobile:StyleSheet>
<mobile:form id="Form1" runat="server">
<mobile:Label id="Label1" runat="server" Text="Today's Special"
StyleReference="title" />
<mobile:TextView id="TextView1" runat="server"
StyleReference="Style1">
Chili
</mobile:TextView>
<mobile:SelectionList runat="server" id="SelectionList1">
<item Text="hot" Value="hot"/>
<item Text="medium" Value="medium"/>
<item Text="mild" Value="mild"/>
</mobile:SelectionList>
<mobile:Command ID="Command1" runat="server" Text="Select Style"
OnClick="SelectStyle" />
</mobile:form>
</body>
</html>
基 Style 類包含所有行動控件通用的樣式特性。 繼承自 類別的 Style 類別包含與其相關聯控件特定的其他樣式特性。
由於行動控件支援的裝置多樣性,所有樣式屬性都是諮詢的,而且可能會根據目標裝置的功能而接受或可能不接受。
Style() |
已淘汰.
初始化 Style 類別的新執行個體。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Alignment |
已淘汰.
代表索引鍵,用於擷取 Alignment 的 Style 設定。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Back |
已淘汰.
從 BackColor 屬性的內嵌樣式表中擷取樣式所使用的索引鍵。 為 ASP.NET 內部使用。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Bold |
已淘汰.
從內嵌樣式表中擷取樣式所使用的索引鍵,用以設定 Bold 的 Font 屬性。 為 ASP.NET 內部使用。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Font |
已淘汰.
針對 Name 屬性的 Font 屬性,從內嵌樣式表中擷取樣式所使用的索引鍵。 為 ASP.NET 內部使用。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Font |
已淘汰.
針對 Size 屬性的 Font 屬性,從內嵌樣式表中擷取樣式所使用的索引鍵。 為 ASP.NET 內部使用。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Fore |
已淘汰.
從 ForeColor 屬性的內嵌樣式表中擷取樣式所使用的索引鍵。 為 ASP.NET 內部使用。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Italic |
已淘汰.
針對 Italic 屬性的 Font 屬性,從內嵌樣式表中擷取樣式所使用的索引鍵。 為 ASP.NET 內部使用。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Wrapping |
已淘汰.
從 Wrapping 的內嵌樣式表中擷取樣式所使用的索引鍵。 為 ASP.NET 內部使用。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Alignment |
已淘汰.
取得或設定樣式的指定對齊方式。 預設值是 NotSet。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Back |
已淘汰.
取得或設定樣式的指定背景色彩。 預設值是 Empty。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Control |
已淘汰.
傳回關聯控制項的強型別參考。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Device |
已淘汰.
取得或設定與控制項關聯的 DeviceSpecific/Choice 建構。 如果不存在這類語法結構,存取子 (Accessor) 就會傳回 |
Font |
已淘汰.
傳回 FontInfo 物件,該物件包含控制項的字型相關資訊。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Fore |
已淘汰.
取得或設定樣式的指定前景色彩。 通常這個屬性會設定文字的色彩。 預設值是 Empty。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Is |
已淘汰.
取得值,指出 Style 物件是否有現用的樣板集。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Is |
已淘汰.
取得值,指出 Style 物件是否正在將變更儲存到它的檢視狀態。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Item[Object, Boolean] |
已淘汰.
使用或不使用繼承,透過金鑰參數傳回樣式。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Item[Object] |
已淘汰.
透過金鑰參數,使用或不使用繼承來傳回樣式。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Name |
已淘汰.
取得或設定指定之物件的名稱。 預設值為空字串 ("")。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
State |
已淘汰.
取得 StateBag 的目前內容。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Style |
已淘汰.
取得或設定 Style 之樣式屬性的參考。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Wrapping |
已淘汰.
取得或設定樣式的指定換行模式。 預設值是 NotSet。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Add |
已淘汰.
將 DeviceSpecific 屬性設定為指定的物件。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Apply |
已淘汰.
將樣式的屬性套用至控制項。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Clone() |
已淘汰.
傳回 Style 物件這個執行個體的複本。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Equals(Object) |
已淘汰.
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
Get |
已淘汰.
做為預設雜湊函式。 (繼承來源 Object) |
Get |
已淘汰.
傳回具有指定名稱的樣板。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Get |
已淘汰.
取得目前執行個體的 Type。 (繼承來源 Object) |
Load |
已淘汰.
將檢視狀態載入 State 物件的 Style。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Memberwise |
已淘汰.
建立目前 Object 的淺層複製。 (繼承來源 Object) |
Register |
已淘汰.
註冊樣式屬性並傳回唯一索引鍵,以便查閱。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
Save |
已淘汰.
將檢視狀態的變更儲存至 Object。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
To |
已淘汰.
傳回代表目前物件的字串。 (繼承來源 Object) |
Track |
已淘汰.
開啟 Style 物件中檢視狀態的追蹤。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
IParser |
已淘汰.
如需這個成員的說明,請參閱 AddParsedSubObject(Object)。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
IState |
已淘汰.
如需這個成員的說明,請參閱 IsTrackingViewState。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
IState |
已淘汰.
如需這個成員的說明,請參閱 LoadViewState(Object)。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
IState |
此 API 支援此產品基礎結構,但無法直接用於程式碼之中。
已淘汰.
如需這個成員的說明,請參閱 SaveViewState()。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
IState |
已淘汰.
如需這個成員的說明,請參閱 TrackViewState()。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET。 |
產品 | 版本 (已過時) |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5 (4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1) |