Style クラス

定義

注意事項

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 モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

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
派生
属性
実装

次の例では、オブジェクト内の 3 つのユーザー定義スタイルを StyleSheet 示します。 オブジェクトは SelectionList 、3 つの定義されたスタイルに対応する 3 つの値を保持します。 コマンド イベントはOnClick、オブジェクトの プロパティをSelectStyleStyleReference変更する 関数を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」を参照してください。

フィールド

AlignmentKey
古い.

AlignmentStyle 設定を取得するためのキーを表します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

BackColorKey
古い.

BackColor プロパティに使用するスタイルを組み込みスタイル シートから取得するためのキー。 ASP.NET によって内部的に使用されます。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

BoldKey
古い.

組み込みスタイル シートから、BoldFont プロパティを設定するためのスタイルを取得するためのキー。 ASP.NET によって内部的に使用されます。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

FontNameKey
古い.

Font プロパティの Name プロパティに使用するスタイルを、組み込みスタイル シートから取得するためのキー。 ASP.NET によって内部的に使用されます。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

FontSizeKey
古い.

Font プロパティの Size プロパティに使用するスタイルを、組み込みスタイル シートから取得するためのキー。 ASP.NET によって内部的に使用されます。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

ForeColorKey
古い.

ForeColor プロパティに使用するスタイルを組み込みスタイル シートから取得するためのキー。 ASP.NET によって内部的に使用されます。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

ItalicKey
古い.

Font プロパティの Italic プロパティに使用するスタイルを、組み込みスタイル シートから取得するためのキー。 ASP.NET によって内部的に使用されます。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

WrappingKey
古い.

Wrapping に使用するスタイルを組み込みスタイル シートから取得するためのキー。 ASP.NET によって内部的に使用されます。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

プロパティ

Alignment
古い.

スタイルとして適用する配置を取得または設定します。 既定値は NotSet です。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

BackColor
古い.

スタイルとして適用する背景色を取得または設定します。 既定値は Empty です。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

Control
古い.

関連するコントロールへの、厳密に型指定された参照を返します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

DeviceSpecific
古い.

コントロールに関連付ける DeviceSpecific の Choice コンストラクトを取得または設定します。 該当するコンストラクトが存在しない場合、アクセサーは null を返します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

Font
古い.

コントロールのフォント情報を格納している FontInfo オブジェクトを返します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

ForeColor
古い.

スタイルとして適用する前景色を取得または設定します。 このプロパティは、通常、テキストの色を設定します。 既定値は Empty です。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

IsTemplated
古い.

Style オブジェクトにアクティブ テンプレート セットがあるかどうかを示す値を取得します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

IsTrackingViewState
古い.

Style オブジェクトがビューステートへの変更を保存しているかどうかを示す値を取得します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

Item[Object, Boolean]
古い.

継承の使用、不使用にかかわらず、key パラメーターを通じてスタイルを返します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

Item[Object]
古い.

継承の使用、不使用にかかわらず、key パラメーターを通じてスタイルを返します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

Name
古い.

指定したオブジェクトの名前を取得または設定します。 既定値は空の文字列 ("") です。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

State
古い.

StateBag の現在の内容を取得します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

StyleReference
古い.

Style のスタイル プロパティへの参照を取得または設定します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

Wrapping
古い.

スタイルとして適用する折り返しモードを取得または設定します。 既定値は NotSet です。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

メソッド

AddParsedSubObject(Object)
古い.

指定したオブジェクトに DeviceSpecific プロパティを設定します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

ApplyTo(WebControl)
古い.

スタイルのプロパティをコントロールに適用します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

Clone()
古い.

Style オブジェクトのこのインスタンスのコピーを返します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

Equals(Object)
古い.

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()
古い.

既定のハッシュ関数として機能します。

(継承元 Object)
GetTemplate(String)
古い.

指定された名前のテンプレートを返します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

GetType()
古い.

現在のインスタンスの Type を取得します。

(継承元 Object)
LoadViewState(Object)
古い.

ビューステートを Style オブジェクトの State に読み込みます。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「mobile Apps & Sites with ASP.NET」を参照してください。

MemberwiseClone()
古い.

現在の Object の簡易コピーを作成します。

(継承元 Object)
RegisterStyle(String, Type, Object, Boolean)
古い.

スタイル プロパティを登録して、参照用の一意なキーを返します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

SaveViewState()
古い.

ビューステートへの変更を Object に保存します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

ToString()
古い.

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
TrackViewState()
古い.

Style オブジェクトのビューステートの追跡を有効にします。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

明示的なインターフェイスの実装

IParserAccessor.AddParsedSubObject(Object)
古い.

このメンバーの詳細については、「AddParsedSubObject(Object)」をご覧ください。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

IStateManager.IsTrackingViewState
古い.

このメンバーの詳細については、「IsTrackingViewState」をご覧ください。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

IStateManager.LoadViewState(Object)
古い.

このメンバーの詳細については、「LoadViewState(Object)」をご覧ください。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

IStateManager.SaveViewState()

この API は製品インフラストラクチャをサポートします。コードから直接使用するものではありません。

古い.

このメンバーの詳細については、「SaveViewState()」をご覧ください。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

IStateManager.TrackViewState()
古い.

このメンバーの詳細については、「TrackViewState()」をご覧ください。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

適用対象

こちらもご覧ください