!-styleとは? わかりやすく解説

Style イベント


Style クラス

ASP.NET モバイル コントロールスタイル特性1 つオブジェクト整理します

名前空間: System.Web.UI.MobileControls
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)
構文構文

Public Class Style
    Implements IParserAccessor, ITemplateable, IStateManager,
 ICloneable
public class Style : IParserAccessor, ITemplateable,
 IStateManager, 
    ICloneable
public ref class Style : IParserAccessor, ITemplateable,
 IStateManager, 
    ICloneable
public class Style implements IParserAccessor,
 ITemplateable, 
    IStateManager, ICloneable
public class Style implements IParserAccessor,
 ITemplateable, 
    IStateManager, ICloneable
解説解説
使用例使用例

3 つのユーザー定義スタイル1 つStyleSheet オブジェクト整理する例を次に示します。この 3 つのスタイル対応する 3 つの値が SelectionList オブジェクト保持されます。OnClick コマンド イベント発生すると、SelectStyle 関数呼び出されます。この関数は、TextView オブジェクトの StyleReference プロパティ変更します

<%@ 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  >
<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>
<%@ 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  >
<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>
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
  System.Web.UI.MobileControls.Style
     System.Web.UI.MobileControls.PagerStyle
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Style クラス

Web サーバー コントロールスタイル表します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Class Style
    Inherits Component
    Implements IStateManager
public class Style : Component, IStateManager
public ref class Style : public
 Component, IStateManager
public class Style extends Component implements
 IStateManager
public class Style extends
 Component implements IStateManager
解説解説
使用例使用例

この例では、Style オブジェクト使用して複数コントロールスタイル プロパティ一度変更する方法示しますStyle プロパティいずれかの値を変更するたびに、各コントロールはその ApplyStyle メソッド呼び出す必要があります含まれているすべてのコントロールが、ここに示すすべてのプロパティサポートするわけではありません。特定のプロパティサポートしないコントロール場合、そのプロパティの値が変更されても、そのコントロール外観変わりません。

メモメモ

次のコード サンプルはシングルファイル コード モデル使用しており、分離コード ファイル直接コピーされ場合正常に動作しない可能性あります。このコード サンプルは、拡張子.aspx の空のテキスト ファイルコピーする必要がありますWeb フォームコード モデル詳細については、「ASP.NET Web ページコード モデル」を参照してください

<%@ Page language="VB" AutoEventWireup="true"
 %>
<%@ Import Namespace="System.Drawing"
 %>
<%@ Import Namespace="System.Data"
 %>

<html>
    <head>
        <script runat="server">

            Private Dim primaryStyle As
 New Style()

            Sub Page_Load(sender As Object,
 e As System.EventArgs)
                If Not Page.IsPostBack Then
                    ' Add data to the borderColorList, 
                    ' backColorList, and foreColorList controls.
                    Dim colors As New
 ListItemCollection()
                    colors.Add(Color.Black.Name)
                    colors.Add(Color.Blue.Name)
                    colors.Add(Color.Green.Name)
                    colors.Add(Color.Orange.Name)
                    colors.Add(Color.Purple.Name)
                    colors.Add(Color.Red.Name)
                    colors.Add(Color.White.Name)
                    colors.Add(Color.Yellow.Name)
                    borderColorList.DataSource = colors
                    borderColorList.DataBind()        
                    backColorList.DataSource = colors
                    backColorList.DataBind()
                    foreColorList.DataSource = colors
                    foreColorList.DataBind()
                
                    ' Add data to the borderStyleList control.
                    Dim styles As New
 ListItemCollection()
                    Dim styleType As Type =
 GetType(BorderStyle)
                    Dim s As String
                    For Each s in
 [Enum].GetNames(styleType)
                        styles.Add(s)
                    Next s
                    borderStyleList.DataSource = styles
                    borderStyleList.DataBind()  

                    ' Add data to the borderWidthList control.
                    Dim widths As New
 ListItemCollection()
                    Dim i As Integer
                    for i = 0 To 10
                        widths.Add(i.ToString() & "px")
                    Next i
                    borderWidthList.DataSource = widths
                    borderWidthList.DataBind()

                    ' Add data to the fontNameList control.
                    Dim names As New
 ListItemCollection()
                    names.Add("Arial")
                    names.Add("Courier")
                    names.Add("Garamond")
                    names.Add("Time New Roman")
                    names.Add("Verdana")
                    fontNameList.DataSource = names
                    fontNameList.DataBind()

                    ' Add data to the fontSizeList control.
                    Dim fontSizes As New
 ListItemCollection()
                    fontSizes.Add("Small")
                    fontSizes.Add("Medium")
                    fontSizes.Add("Large")
                    fontSizes.Add("10pt")
                    fontSizes.Add("14pt")
                    fontSizes.Add("20pt")
                    fontSizeList.DataSource = fontSizes
                    fontSizeList.DataBind()
                    
                    ' Set primaryStyle as the style for each control.
                    Label1.ApplyStyle(primaryStyle)
                    ListBox1.ApplyStyle(primaryStyle)
                    Button1.ApplyStyle(primaryStyle)
                    Table1.ApplyStyle(primaryStyle)
                    TextBox1.ApplyStyle(primaryStyle)
                End If
            End Sub

            Sub ChangeBorderColor(sender As
 Object, e As System.EventArgs)
                primaryStyle.BorderColor = _
                    Color.FromName(borderColorList.SelectedItem.Text)
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub

            Sub ChangeBackColor(sender As Object,
 e As System.EventArgs)
                primaryStyle.BackColor = _
                    Color.FromName(backColorList.SelectedItem.Text)
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub

            Sub ChangeForeColor(sender As Object,
 e As System.EventArgs)
                primaryStyle.ForeColor = _
                    Color.FromName(foreColorList.SelectedItem.Text)
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub

            Sub ChangeBorderStyle(sender As
 Object, e As System.EventArgs)
                primaryStyle.BorderStyle = _
                    CType([Enum].Parse(GetType(BorderStyle), _
                    borderStyleList.SelectedItem.Text), BorderStyle)
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub

            Sub ChangeBorderWidth(sender As
 Object, e As System.EventArgs)
                primaryStyle.BorderWidth = _
                    Unit.Parse(borderWidthList.SelectedItem.Text)
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub

            Sub ChangeFont(sender As Object,
 e As System.EventArgs)
                primaryStyle.Font.Name = _
                    fontNameList.SelectedItem.Text
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub

            Sub ChangeFontSize(sender As Object,
 e As System.EventArgs)
                primaryStyle.Font.Size = _
                    FontUnit.Parse(fontSizeList.SelectedItem.Text)
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub
        </script>
    </head>

    <body>
        <form id="Form1" runat="server">
            <table cellPadding="6" border="0">
                <tr>
                    <td>
                        <asp:label id="Label1"
 
                            Text="Border Properties Example"
 Runat="server">
                            <center><br>Label Styles</center>
                        </asp:label>
                    </td>
                    <td>
                        <asp:button id="Button1"
 runat="server" 
                            Text="Button Styles">
                        </asp:button>
                    </td>
                    <td>
                        <asp:listbox id="ListBox1"
 Runat="server">
                            <asp:ListItem Value="0"
 Text="List Item 0">
                            </asp:ListItem>
                            <asp:ListItem Value="1"
 Text="List Item 1">
                            </asp:ListItem>
                            <asp:ListItem Value="2"
 Text="List Item 2">
                            </asp:ListItem>
                        </asp:listbox>
                    </td>
                    <td>
                        <asp:textbox id="TextBox1"
 
                            Text="TextBox Styles"
 Runat="server">
                        </asp:textbox>
                    </td>
                    <td>
                        <asp:table id="Table1"
 Runat="server">
                            <asp:TableRow>
                                <asp:TableCell Text="(0,0)"></asp:TableCell>
                                <asp:TableCell Text="(0,1)"></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell Text="(1,0)"></asp:TableCell>
                                <asp:TableCell Text="(1,1)"></asp:TableCell>
                            </asp:TableRow>
                        </asp:table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label Runat="server"
 Text="Border Color:">
                        </asp:Label>
                        <asp:dropdownlist id="borderColorList"
 
                            Runat="server" AutoPostBack="True"
 
                            OnSelectedIndexChanged="ChangeBorderColor">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server"
 Text="Border Style:">
                        </asp:Label>
                        <asp:dropdownlist id="borderStyleList"
 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeBorderStyle">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server"
 Text="Border Width">
                        </asp:Label>
                        <asp:dropdownlist id="borderWidthList"
 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeBorderWidth">
                        </asp:dropdownlist>
                    </td>
                    <td>
                        <asp:Label Runat="server"
 Text="Back Color:">
                        </asp:Label>
                        <asp:dropdownlist id="backColorList"
 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeBackColor">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server"
 Text="Foreground Color:">
                        </asp:Label>
                        <asp:dropdownlist id="foreColorList"
 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeForeColor">
                        </asp:dropdownlist>
                    </td>
                    <td>
                        <asp:Label Runat="server"
 Text="Font Name:">
                        </asp:Label>
                        <asp:dropdownlist id="fontNameList"
 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeFont">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server"
 Text="Font Size:">
                        </asp:Label>
                        <asp:dropdownlist id="fontSizeList"
 
                            Runat="server" AutoPostBack="True"
 
                            OnSelectedIndexChanged="ChangeFontSize">
                        </asp:dropdownlist>
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>
<%@ Page language="C#" AutoEventWireup="true"
 %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Data" %>

<html>
    <head>
        <script runat="server">

            private Style primaryStyle = new
 Style();

            void Page_Load(object sender, System.EventArgs e)
            {
                if (!Page.IsPostBack)
                {
                    // Add data to the borderColorList, 
                    // backColorList, and foreColorList controls.
                    ListItemCollection colors = new ListItemCollection();
                    colors.Add(Color.Black.Name);
                    colors.Add(Color.Blue.Name);
                    colors.Add(Color.Green.Name);
                    colors.Add(Color.Orange.Name);
                    colors.Add(Color.Purple.Name);
                    colors.Add(Color.Red.Name);
                    colors.Add(Color.White.Name);
                    colors.Add(Color.Yellow.Name);
                    borderColorList.DataSource = colors;
                    borderColorList.DataBind();         
                    backColorList.DataSource = colors;
                    backColorList.DataBind();
                    foreColorList.DataSource = colors;
                    foreColorList.DataBind();

                    // Add data to the borderStyleList control.
                    ListItemCollection styles = new ListItemCollection();
                    Type styleType = typeof(BorderStyle);
                    foreach (string s in
 Enum.GetNames(styleType))
                    {
                        styles.Add(s);
                    }
                    borderStyleList.DataSource = styles;
                    borderStyleList.DataBind();  

                    // Add data to the borderWidthList control.
                    ListItemCollection widths = new ListItemCollection();
                    for (int i = 0; i <
 11; i++)
                    {
                        widths.Add(i.ToString() + "px");
                    }
                    borderWidthList.DataSource = widths;
                    borderWidthList.DataBind();

                    // Add data to the fontNameList control.
                    ListItemCollection names = new ListItemCollection();
                    names.Add("Arial");
                    names.Add("Courier");
                    names.Add("Garamond");
                    names.Add("Time New Roman");
                    names.Add("Verdana");
                    fontNameList.DataSource = names;
                    fontNameList.DataBind();

                    // Add data to the fontSizeList control.
                    ListItemCollection fontSizes = new ListItemCollection();
                    fontSizes.Add("Small");
                    fontSizes.Add("Medium");
                    fontSizes.Add("Large");
                    fontSizes.Add("10pt");
                    fontSizes.Add("14pt");
                    fontSizes.Add("20pt");
                    fontSizeList.DataSource = fontSizes;
                    fontSizeList.DataBind();
                    
                    //Set primaryStyle as the style for each control.
                    Label1.ApplyStyle(primaryStyle);
                    ListBox1.ApplyStyle(primaryStyle);
                    Button1.ApplyStyle(primaryStyle);
                    Table1.ApplyStyle(primaryStyle);
                    TextBox1.ApplyStyle(primaryStyle);
                }
            }
            void ChangeBorderColor(object sender, System.EventArgs
 e)
            {
                primaryStyle.BorderColor = 
                    Color.FromName(borderColorList.SelectedItem.Text);
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }
    
            void ChangeBackColor(object sender, System.EventArgs
 e)
            {
                primaryStyle.BackColor = 
                    Color.FromName(backColorList.SelectedItem.Text);
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }

            void ChangeForeColor(object sender, System.EventArgs
 e)
            {
                primaryStyle.ForeColor = 
                    Color.FromName(foreColorList.SelectedItem.Text);
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }

            void ChangeBorderStyle(object sender, System.EventArgs
 e)
            {
                primaryStyle.BorderStyle = 
                    (BorderStyle)Enum.Parse(typeof(BorderStyle), 
                    borderStyleList.SelectedItem.Text);
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }

            void ChangeBorderWidth(object sender, System.EventArgs
 e)
            {
                primaryStyle.BorderWidth = 
                    Unit.Parse(borderWidthList.SelectedItem.Text);
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }

            void ChangeFont(object sender, System.EventArgs e)
            {
                primaryStyle.Font.Name = 
                    fontNameList.SelectedItem.Text;
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }

            void ChangeFontSize(object sender, System.EventArgs
 e)
            {
                primaryStyle.Font.Size = 
                    FontUnit.Parse(fontSizeList.SelectedItem.Text);
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }
        </script>
    </head>

    <body>
        <form id="Form1" runat="server">
            <table cellPadding="6" border="0">
                <tr>
                    <td>
                        <asp:label id="Label1" 
                            Text="Border Properties Example" Runat="server">
                            <center><br>Label Styles</center>
                        </asp:label>
                    </td>
                    <td>
                        <asp:button id="Button1" runat="server"
 
                            Text="Button Styles">
                        </asp:button>
                    </td>
                    <td>
                        <asp:listbox id="ListBox1" Runat="server">
                            <asp:ListItem Value="0" Text="List
 Item 0">
                            </asp:ListItem>
                            <asp:ListItem Value="1" Text="List
 Item 1">
                            </asp:ListItem>
                            <asp:ListItem Value="2" Text="List
 Item 2">
                            </asp:ListItem>
                        </asp:listbox>
                    </td>
                    <td>
                        <asp:textbox id="TextBox1" 
                            Text="TextBox Styles" Runat="server">
                        </asp:textbox>
                    </td>
                    <td>
                        <asp:table id="Table1" Runat="server">
                            <asp:TableRow>
                                <asp:TableCell Text="(0,0)"></asp:TableCell>
                                <asp:TableCell Text="(0,1)"></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell Text="(1,0)"></asp:TableCell>
                                <asp:TableCell Text="(1,1)"></asp:TableCell>
                            </asp:TableRow>
                        </asp:table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label Runat="server" Text="Border
 Color:">
                        </asp:Label>
                        <asp:dropdownlist id="borderColorList" 
                            Runat="server" AutoPostBack="True"
 
                            OnSelectedIndexChanged="ChangeBorderColor">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server" Text="Border
 Style:">
                        </asp:Label>
                        <asp:dropdownlist id="borderStyleList" 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeBorderStyle">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server" Text="Border
 Width">
                        </asp:Label>
                        <asp:dropdownlist id="borderWidthList" 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeBorderWidth">
                        </asp:dropdownlist>
                    </td>
                    <td>
                        <asp:Label Runat="server" Text="Back Color:">
                        </asp:Label>
                        <asp:dropdownlist id="backColorList" 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeBackColor">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server" Text="Foreground
 Color:">
                        </asp:Label>
                        <asp:dropdownlist id="foreColorList" 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeForeColor">
                        </asp:dropdownlist>
                    </td>
                    <td>
                        <asp:Label Runat="server" Text="Font Name:">
                        </asp:Label>
                        <asp:dropdownlist id="fontNameList" 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeFont">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server" Text="Font Size:">
                        </asp:Label>
                        <asp:dropdownlist id="fontSizeList" 
                            Runat="server" AutoPostBack="True"
 
                            OnSelectedIndexChanged="ChangeFontSize">
                        </asp:dropdownlist>
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
      System.Web.UI.WebControls.Style
         派生クラス
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Style コンストラクタ ()

既定値使用して Style クラス新しインスタンス初期化します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

解説解説
使用例使用例

この例では、Style オブジェクト使用して複数コントロールスタイル プロパティ一度変更する方法示しますStyle プロパティいずれかの値を変更するたびに、各コントロールはその ApplyStyle メソッド呼び出す必要があります含まれているすべてのコントロールが、ここに示すすべてのプロパティサポートするわけではありません。特定のプロパティサポートしないコントロール場合、そのプロパティの値が変更されても、そのコントロール外観変わりません。

メモメモ

次のコード サンプルはシングルファイル コード モデル使用しており、分離コード ファイル直接コピーされ場合正常に動作しない可能性あります。このコード サンプルは、拡張子.aspx の空のテキスト ファイルコピーする必要がありますWeb フォームコード モデル詳細については、「ASP.NET Web ページコード モデル」を参照してください

<%@ Page language="VB" AutoEventWireup="true"
 %>
<%@ Import Namespace="System.Drawing"
 %>
<%@ Import Namespace="System.Data"
 %>

<html>
    <head>
        <script runat="server">

            Private Dim primaryStyle As
 New Style()

            Sub Page_Load(sender As Object,
 e As System.EventArgs)
                If Not Page.IsPostBack Then
                    ' Add data to the borderColorList, 
                    ' backColorList, and foreColorList controls.
                    Dim colors As New
 ListItemCollection()
                    colors.Add(Color.Black.Name)
                    colors.Add(Color.Blue.Name)
                    colors.Add(Color.Green.Name)
                    colors.Add(Color.Orange.Name)
                    colors.Add(Color.Purple.Name)
                    colors.Add(Color.Red.Name)
                    colors.Add(Color.White.Name)
                    colors.Add(Color.Yellow.Name)
                    borderColorList.DataSource = colors
                    borderColorList.DataBind()        
                    backColorList.DataSource = colors
                    backColorList.DataBind()
                    foreColorList.DataSource = colors
                    foreColorList.DataBind()
                
                    ' Add data to the borderStyleList control.
                    Dim styles As New
 ListItemCollection()
                    Dim styleType As Type =
 GetType(BorderStyle)
                    Dim s As String
                    For Each s in
 [Enum].GetNames(styleType)
                        styles.Add(s)
                    Next s
                    borderStyleList.DataSource = styles
                    borderStyleList.DataBind()  

                    ' Add data to the borderWidthList control.
                    Dim widths As New
 ListItemCollection()
                    Dim i As Integer
                    for i = 0 To 10
                        widths.Add(i.ToString() & "px")
                    Next i
                    borderWidthList.DataSource = widths
                    borderWidthList.DataBind()

                    ' Add data to the fontNameList control.
                    Dim names As New
 ListItemCollection()
                    names.Add("Arial")
                    names.Add("Courier")
                    names.Add("Garamond")
                    names.Add("Time New Roman")
                    names.Add("Verdana")
                    fontNameList.DataSource = names
                    fontNameList.DataBind()

                    ' Add data to the fontSizeList control.
                    Dim fontSizes As New
 ListItemCollection()
                    fontSizes.Add("Small")
                    fontSizes.Add("Medium")
                    fontSizes.Add("Large")
                    fontSizes.Add("10pt")
                    fontSizes.Add("14pt")
                    fontSizes.Add("20pt")
                    fontSizeList.DataSource = fontSizes
                    fontSizeList.DataBind()
                    
                    ' Set primaryStyle as the style for each control.
                    Label1.ApplyStyle(primaryStyle)
                    ListBox1.ApplyStyle(primaryStyle)
                    Button1.ApplyStyle(primaryStyle)
                    Table1.ApplyStyle(primaryStyle)
                    TextBox1.ApplyStyle(primaryStyle)
                End If
            End Sub

            Sub ChangeBorderColor(sender As
 Object, e As System.EventArgs)
                primaryStyle.BorderColor = _
                    Color.FromName(borderColorList.SelectedItem.Text)
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub

            Sub ChangeBackColor(sender As Object,
 e As System.EventArgs)
                primaryStyle.BackColor = _
                    Color.FromName(backColorList.SelectedItem.Text)
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub

            Sub ChangeForeColor(sender As Object,
 e As System.EventArgs)
                primaryStyle.ForeColor = _
                    Color.FromName(foreColorList.SelectedItem.Text)
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub

            Sub ChangeBorderStyle(sender As
 Object, e As System.EventArgs)
                primaryStyle.BorderStyle = _
                    CType([Enum].Parse(GetType(BorderStyle), _
                    borderStyleList.SelectedItem.Text), BorderStyle)
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub

            Sub ChangeBorderWidth(sender As
 Object, e As System.EventArgs)
                primaryStyle.BorderWidth = _
                    Unit.Parse(borderWidthList.SelectedItem.Text)
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub

            Sub ChangeFont(sender As Object,
 e As System.EventArgs)
                primaryStyle.Font.Name = _
                    fontNameList.SelectedItem.Text
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub

            Sub ChangeFontSize(sender As Object,
 e As System.EventArgs)
                primaryStyle.Font.Size = _
                    FontUnit.Parse(fontSizeList.SelectedItem.Text)
                Label1.ApplyStyle(primaryStyle)
                ListBox1.ApplyStyle(primaryStyle)
                Button1.ApplyStyle(primaryStyle)
                Table1.ApplyStyle(primaryStyle)
                TextBox1.ApplyStyle(primaryStyle)
            End Sub
        </script>
    </head>

    <body>
        <form id="Form1" runat="server">
            <table cellPadding="6" border="0">
                <tr>
                    <td>
                        <asp:label id="Label1"
 
                            Text="Border Properties Example"
 Runat="server">
                            <center><br>Label Styles</center>
                        </asp:label>
                    </td>
                    <td>
                        <asp:button id="Button1"
 runat="server" 
                            Text="Button Styles">
                        </asp:button>
                    </td>
                    <td>
                        <asp:listbox id="ListBox1"
 Runat="server">
                            <asp:ListItem Value="0"
 Text="List Item 0">
                            </asp:ListItem>
                            <asp:ListItem Value="1"
 Text="List Item 1">
                            </asp:ListItem>
                            <asp:ListItem Value="2"
 Text="List Item 2">
                            </asp:ListItem>
                        </asp:listbox>
                    </td>
                    <td>
                        <asp:textbox id="TextBox1"
 
                            Text="TextBox Styles"
 Runat="server">
                        </asp:textbox>
                    </td>
                    <td>
                        <asp:table id="Table1"
 Runat="server">
                            <asp:TableRow>
                                <asp:TableCell Text="(0,0)"></asp:TableCell>
                                <asp:TableCell Text="(0,1)"></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell Text="(1,0)"></asp:TableCell>
                                <asp:TableCell Text="(1,1)"></asp:TableCell>
                            </asp:TableRow>
                        </asp:table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label Runat="server"
 Text="Border Color:">
                        </asp:Label>
                        <asp:dropdownlist id="borderColorList"
 
                            Runat="server" AutoPostBack="True"
 
                            OnSelectedIndexChanged="ChangeBorderColor">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server"
 Text="Border Style:">
                        </asp:Label>
                        <asp:dropdownlist id="borderStyleList"
 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeBorderStyle">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server"
 Text="Border Width">
                        </asp:Label>
                        <asp:dropdownlist id="borderWidthList"
 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeBorderWidth">
                        </asp:dropdownlist>
                    </td>
                    <td>
                        <asp:Label Runat="server"
 Text="Back Color:">
                        </asp:Label>
                        <asp:dropdownlist id="backColorList"
 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeBackColor">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server"
 Text="Foreground Color:">
                        </asp:Label>
                        <asp:dropdownlist id="foreColorList"
 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeForeColor">
                        </asp:dropdownlist>
                    </td>
                    <td>
                        <asp:Label Runat="server"
 Text="Font Name:">
                        </asp:Label>
                        <asp:dropdownlist id="fontNameList"
 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeFont">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server"
 Text="Font Size:">
                        </asp:Label>
                        <asp:dropdownlist id="fontSizeList"
 
                            Runat="server" AutoPostBack="True"
 
                            OnSelectedIndexChanged="ChangeFontSize">
                        </asp:dropdownlist>
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>
<%@ Page language="C#" AutoEventWireup="true"
 %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Data" %>

<html>
    <head>
        <script runat="server">

            private Style primaryStyle = new
 Style();

            void Page_Load(object sender, System.EventArgs e)
            {
                if (!Page.IsPostBack)
                {
                    // Add data to the borderColorList, 
                    // backColorList, and foreColorList controls.
                    ListItemCollection colors = new ListItemCollection();
                    colors.Add(Color.Black.Name);
                    colors.Add(Color.Blue.Name);
                    colors.Add(Color.Green.Name);
                    colors.Add(Color.Orange.Name);
                    colors.Add(Color.Purple.Name);
                    colors.Add(Color.Red.Name);
                    colors.Add(Color.White.Name);
                    colors.Add(Color.Yellow.Name);
                    borderColorList.DataSource = colors;
                    borderColorList.DataBind();         
                    backColorList.DataSource = colors;
                    backColorList.DataBind();
                    foreColorList.DataSource = colors;
                    foreColorList.DataBind();

                    // Add data to the borderStyleList control.
                    ListItemCollection styles = new ListItemCollection();
                    Type styleType = typeof(BorderStyle);
                    foreach (string s in
 Enum.GetNames(styleType))
                    {
                        styles.Add(s);
                    }
                    borderStyleList.DataSource = styles;
                    borderStyleList.DataBind();  

                    // Add data to the borderWidthList control.
                    ListItemCollection widths = new ListItemCollection();
                    for (int i = 0; i <
 11; i++)
                    {
                        widths.Add(i.ToString() + "px");
                    }
                    borderWidthList.DataSource = widths;
                    borderWidthList.DataBind();

                    // Add data to the fontNameList control.
                    ListItemCollection names = new ListItemCollection();
                    names.Add("Arial");
                    names.Add("Courier");
                    names.Add("Garamond");
                    names.Add("Time New Roman");
                    names.Add("Verdana");
                    fontNameList.DataSource = names;
                    fontNameList.DataBind();

                    // Add data to the fontSizeList control.
                    ListItemCollection fontSizes = new ListItemCollection();
                    fontSizes.Add("Small");
                    fontSizes.Add("Medium");
                    fontSizes.Add("Large");
                    fontSizes.Add("10pt");
                    fontSizes.Add("14pt");
                    fontSizes.Add("20pt");
                    fontSizeList.DataSource = fontSizes;
                    fontSizeList.DataBind();
                    
                    //Set primaryStyle as the style for each control.
                    Label1.ApplyStyle(primaryStyle);
                    ListBox1.ApplyStyle(primaryStyle);
                    Button1.ApplyStyle(primaryStyle);
                    Table1.ApplyStyle(primaryStyle);
                    TextBox1.ApplyStyle(primaryStyle);
                }
            }
            void ChangeBorderColor(object sender, System.EventArgs
 e)
            {
                primaryStyle.BorderColor = 
                    Color.FromName(borderColorList.SelectedItem.Text);
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }
    
            void ChangeBackColor(object sender, System.EventArgs
 e)
            {
                primaryStyle.BackColor = 
                    Color.FromName(backColorList.SelectedItem.Text);
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }

            void ChangeForeColor(object sender, System.EventArgs
 e)
            {
                primaryStyle.ForeColor = 
                    Color.FromName(foreColorList.SelectedItem.Text);
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }

            void ChangeBorderStyle(object sender, System.EventArgs
 e)
            {
                primaryStyle.BorderStyle = 
                    (BorderStyle)Enum.Parse(typeof(BorderStyle), 
                    borderStyleList.SelectedItem.Text);
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }

            void ChangeBorderWidth(object sender, System.EventArgs
 e)
            {
                primaryStyle.BorderWidth = 
                    Unit.Parse(borderWidthList.SelectedItem.Text);
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }

            void ChangeFont(object sender, System.EventArgs e)
            {
                primaryStyle.Font.Name = 
                    fontNameList.SelectedItem.Text;
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }

            void ChangeFontSize(object sender, System.EventArgs
 e)
            {
                primaryStyle.Font.Size = 
                    FontUnit.Parse(fontSizeList.SelectedItem.Text);
                Label1.ApplyStyle(primaryStyle);
                ListBox1.ApplyStyle(primaryStyle);
                Button1.ApplyStyle(primaryStyle);
                Table1.ApplyStyle(primaryStyle);
                TextBox1.ApplyStyle(primaryStyle);
            }
        </script>
    </head>

    <body>
        <form id="Form1" runat="server">
            <table cellPadding="6" border="0">
                <tr>
                    <td>
                        <asp:label id="Label1" 
                            Text="Border Properties Example" Runat="server">
                            <center><br>Label Styles</center>
                        </asp:label>
                    </td>
                    <td>
                        <asp:button id="Button1" runat="server"
 
                            Text="Button Styles">
                        </asp:button>
                    </td>
                    <td>
                        <asp:listbox id="ListBox1" Runat="server">
                            <asp:ListItem Value="0" Text="List
 Item 0">
                            </asp:ListItem>
                            <asp:ListItem Value="1" Text="List
 Item 1">
                            </asp:ListItem>
                            <asp:ListItem Value="2" Text="List
 Item 2">
                            </asp:ListItem>
                        </asp:listbox>
                    </td>
                    <td>
                        <asp:textbox id="TextBox1" 
                            Text="TextBox Styles" Runat="server">
                        </asp:textbox>
                    </td>
                    <td>
                        <asp:table id="Table1" Runat="server">
                            <asp:TableRow>
                                <asp:TableCell Text="(0,0)"></asp:TableCell>
                                <asp:TableCell Text="(0,1)"></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell Text="(1,0)"></asp:TableCell>
                                <asp:TableCell Text="(1,1)"></asp:TableCell>
                            </asp:TableRow>
                        </asp:table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label Runat="server" Text="Border
 Color:">
                        </asp:Label>
                        <asp:dropdownlist id="borderColorList" 
                            Runat="server" AutoPostBack="True"
 
                            OnSelectedIndexChanged="ChangeBorderColor">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server" Text="Border
 Style:">
                        </asp:Label>
                        <asp:dropdownlist id="borderStyleList" 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeBorderStyle">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server" Text="Border
 Width">
                        </asp:Label>
                        <asp:dropdownlist id="borderWidthList" 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeBorderWidth">
                        </asp:dropdownlist>
                    </td>
                    <td>
                        <asp:Label Runat="server" Text="Back Color:">
                        </asp:Label>
                        <asp:dropdownlist id="backColorList" 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeBackColor">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server" Text="Foreground
 Color:">
                        </asp:Label>
                        <asp:dropdownlist id="foreColorList" 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeForeColor">
                        </asp:dropdownlist>
                    </td>
                    <td>
                        <asp:Label Runat="server" Text="Font Name:">
                        </asp:Label>
                        <asp:dropdownlist id="fontNameList" 
                            Runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="ChangeFont">
                        </asp:dropdownlist>
                        <br>
                        <asp:Label Runat="server" Text="Font Size:">
                        </asp:Label>
                        <asp:dropdownlist id="fontSizeList" 
                            Runat="server" AutoPostBack="True"
 
                            OnSelectedIndexChanged="ChangeFontSize">
                        </asp:dropdownlist>
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Style コンストラクタ (StateBag)

指定した状態バッグ情報使用して、Style クラス新しインスタンス初期化します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Sub New ( _
    bag As StateBag _
)
Dim bag As StateBag

Dim instance As New Style(bag)
public Style (
    StateBag bag
)
public:
Style (
    StateBag^ bag
)
public Style (
    StateBag bag
)
public function Style (
    bag : StateBag
)

パラメータ

bag

スタイル情報格納先の状態バッグを表す System.Web.UI.StateBag。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Style コンストラクタ


Style コンストラクタ


Style フィールド


パブリック フィールドパブリック フィールド

  名前 説明
パブリック フィールド AlignmentKey Style の Alignment 設定取得するためのキー表します
パブリック フィールド BackColorKey BackColor プロパティ使用するスタイル組み込みスタイル シートから取得するためのキーASP.NET によって内部的に使用されます。
パブリック フィールド BoldKey 組み込みスタイル シートから、FontBold プロパティ設定するためのスタイル取得するためのキーASP.NET によって内部的に使用されます。
パブリック フィールド FontNameKey Font プロパティName プロパティ使用するスタイルを、組み込みスタイル シートから取得するためのキーASP.NET によって内部的に使用されます。
パブリック フィールド FontSizeKey Font プロパティSize プロパティ使用するスタイルを、組み込みスタイル シートから取得するためのキーASP.NET によって内部的に使用されます。
パブリック フィールド ForeColorKey ForeColor プロパティ使用するスタイル組み込みスタイル シートから取得するためのキーASP.NET によって内部的に使用されます。
パブリック フィールド ItalicKey Font プロパティItalic プロパティ使用するスタイルを、組み込みスタイル シートから取得するためのキーASP.NET によって内部的に使用されます。
パブリック フィールド WrappingKey Wrapping使用するスタイル組み込みスタイル シートから取得するためのキーASP.NET によって内部的に使用されます。
参照参照

関連項目

Style クラス
System.Web.UI.MobileControls 名前空間
Name

その他の技術情報

StyleSheet コントロール概要

Style プロパティ


パブリック プロパティパブリック プロパティ

( プロテクト プロパティ参照)
  名前 説明
パブリック プロパティ Alignment スタイルとして適用する配置取得または設定します既定値は Alignment.NotSet です。
パブリック プロパティ BackColor スタイルとして適用する背景色取得または設定します既定値は Color.Empty です。
パブリック プロパティ Control 関連するコントロールへの、厳密に指定され参照返します
パブリック プロパティ DeviceSpecific コントロール関連付ける DeviceSpecific の Choice コンストラクト取得または設定します該当するコンストラクト存在しない場合アクセサnull 参照 (Visual Basic では Nothing) を返します
パブリック プロパティ Font コントロールフォント情報格納している FontInfo オブジェクト返します
パブリック プロパティ ForeColor スタイルとして適用する前景色を取得または設定します。このプロパティは、通常テキストの色を設定します既定値Empty です。
パブリック プロパティ IsTemplated Style オブジェクトアクティブ テンプレート セットがあるかどうかを示す値を取得します
パブリック プロパティ Item オーバーロードされます継承使用不使用かかわらずkey パラメータ通じてスタイル返します
パブリック プロパティ Name 指定したオブジェクトの名前を取得または設定します既定値空の文字列 ("") です。
パブリック プロパティ StyleReference Styleスタイル プロパティへの参照取得または設定します
パブリック プロパティ Wrapping スタイルとして適用する折り返しモード取得または設定します既定値は NotSet です。
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ IsTrackingViewState Style オブジェクトビューステートへの変更保存しているかどうかを示す値を取得します
プロテクト プロパティ State StateBag の現在の内容取得します
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Web.UI.IStateManager.IsTrackingViewState このメンバ説明については、IStateManager.IsTrackingViewState のトピック参照してください
参照参照

関連項目

Style クラス
System.Web.UI.MobileControls 名前空間
Name

その他の技術情報

StyleSheet コントロール概要

Style プロパティ


パブリック プロパティパブリック プロパティ

( プロテクト プロパティ参照)
  名前 説明
パブリック プロパティ BackColor Web サーバー コントロール背景色取得または設定します
パブリック プロパティ BorderColor Web サーバー コントロール境界線の色を取得または設定します
パブリック プロパティ BorderStyle Web サーバー コントロール境界線スタイル取得または設定します
パブリック プロパティ BorderWidth Web サーバー コントロール境界線の幅を取得または設定します
パブリック プロパティ Container  Component格納している IContainer を取得します。 ( Component から継承されます。)
パブリック プロパティ CssClass クライアントWeb サーバー コントロールによって表示されるカスケード スタイル シート (CSS: Cascading Style Sheet) クラス取得または設定します
パブリック プロパティ Font Web サーバー コントロール関連付けられたフォント プロパティ取得します
パブリック プロパティ ForeColor Web サーバー コントロール前景色 (通常テキストの色) を取得または設定します
パブリック プロパティ Height Web サーバー コントロールの高さを取得または設定します
パブリック プロパティ IsEmpty 保護されているプロパティスタイル要素が状態バッグ定義されているかどうかを示す値を取得します
パブリック プロパティ RegisteredCssClass コントロール登録されているカスケード スタイル シート (CSS) を取得します
パブリック プロパティ Site  Component の ISite を取得または設定します。 ( Component から継承されます。)
パブリック プロパティ Width Web サーバー コントロールの幅を取得または設定します
プロテクト プロパティプロテクト プロパティ
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Web.UI.IStateManager.IsTrackingViewState このメンバ説明については、IStateManager.IsTrackingViewState のトピック参照してください
参照参照

関連項目

Style クラス
System.Web.UI.WebControls 名前空間
BackColor
ForeColor
BorderWidth
BorderStyle
BorderColor
Height
Width

その他の技術情報

ASP.NETテーマスキン概要
ASP.NET Web サーバー コントロールCSS スタイル
ASP.NET Web サーバー コントロールブラウザ機能

Style メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Web.UI.IParserAccessor.AddParsedSubObject このメンバ説明については、「IParserAccessor.AddParsedSubObject」を参照してください
インターフェイスの明示的な実装 System.Web.UI.IStateManager.LoadViewState このメンバ説明については、「IStateManager.LoadViewState」を参照してください
インターフェイスの明示的な実装 System.Web.UI.IStateManager.SaveViewState このメンバ説明については、「IStateManager.SaveViewState」を参照してください
インターフェイスの明示的な実装 System.Web.UI.IStateManager.TrackViewState このメンバ説明については、「IStateManager.TrackViewState」を参照してください
参照参照

関連項目

Style クラス
System.Web.UI.MobileControls 名前空間
Name

その他の技術情報

StyleSheet コントロール概要

Style メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド AddAttributesToRender オーバーロードされます指定した System.Web.UI.HtmlTextWriter に表示する必要のある HTML 属性およびスタイル追加します。このメソッドは、主にコントロール開発者によって使用されます。
パブリック メソッド CopyFrom 指定した Style のスタイル プロパティをこのメソッド呼び出し元である Style クラスインスタンス複製します
パブリック メソッド CreateObjRef  リモート オブジェクトとの通信使用するプロキシ生成必要な情報をすべて格納しているオブジェクト作成します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド Dispose  オーバーロードされますComponent によって使用されているリソース解放します。 ( Component から継承されます。)
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 ( Object から継承されます。)
パブリック メソッド GetLifetimeService  対象インスタンス有効期間ポリシー制御する現在の有効期間サービス オブジェクト取得します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド GetStyleAttributes 指定された System.Web.UI.IUrlResolutionService 実装オブジェクトの System.Web.UI.CssStyleCollection オブジェクト取得します
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド InitializeLifetimeService  対象インスタンス有効期間ポリシー制御する有効期間サービス オブジェクト取得します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド MergeWith 指定した Styleスタイル プロパティをこのメソッド呼び出し元である Style クラスインスタンス結合します
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド Reset 定義されスタイル要素を状態バッグから削除します
パブリック メソッド SetDirty Styleマーク付けて、その状態がビューステート記録されるようにします。
パブリック メソッド ToString  Component の名前を格納している String返します (存在する場合)。このメソッドオーバーライドできません。 ( Component から継承されます。)
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド Dispose  オーバーロードされますComponent によって使用されているリソース解放します。 ( Component から継承されます。)
プロテクト メソッド FillStyleAttributes 指定されオブジェクトスタイル プロパティSystem.Web.UI.CssStyleCollection オブジェクト追加します
プロテクト メソッド Finalize  Componentガベージ コレクションによってクリアされる前に、アンマネージ リソース解放しその他のクリーンアップ操作実行します。 ( Component から継承されます。)
プロテクト メソッド GetService  Component またはその Container提供されるサービスを表すオブジェクト返します。 ( Component から継承されます。)
プロテクト メソッド LoadViewState 以前保存した状態を読み込みます。
プロテクト メソッド MemberwiseClone  オーバーロードされます。 ( MarshalByRefObject から継承されます。)
プロテクト メソッド SaveViewState 保護されているメソッド。TrackViewState メソッド呼び出し後に変更された状態をすべて保存します
プロテクト メソッド SetBit 保護されている内部メソッド。状態バッグ格納されているスタイル プロパティを示す内部ビットマスク フィールド設定します
プロテクト メソッド TrackViewState 保護されているメソッド状態変化追跡開始位置コントロールマークします。"マーク" の後で加えられ変更はすべて追跡されコントロールビューステート一部として保存されます。
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Web.UI.IStateManager.LoadViewState 以前保存した状態を読み込みます。
インターフェイスの明示的な実装 System.Web.UI.IStateManager.SaveViewState 状態の変化を示すオブジェクト返します
インターフェイスの明示的な実装 System.Web.UI.IStateManager.TrackViewState 状態変化追跡開始します
参照参照

関連項目

Style クラス
System.Web.UI.WebControls 名前空間
BackColor
ForeColor
BorderWidth
BorderStyle
BorderColor
Height
Width

その他の技術情報

ASP.NETテーマスキン概要
ASP.NET Web サーバー コントロールCSS スタイル
ASP.NET Web サーバー コントロールブラウザ機能

Style メンバ

ASP.NET モバイル コントロールスタイル特性1 つオブジェクト整理します

Style データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
パブリック フィールドパブリック フィールド
  名前 説明
パブリック フィールド AlignmentKey StyleAlignment 設定取得するためのキー表します
パブリック フィールド BackColorKey BackColor プロパティ使用するスタイル組み込みスタイル シートから取得するためのキーASP.NET によって内部的に使用されます。
パブリック フィールド BoldKey 組み込みスタイル シートから、FontBold プロパティ設定するためのスタイル取得するためのキーASP.NET によって内部的に使用されます。
パブリック フィールド FontNameKey Font プロパティName プロパティ使用するスタイルを、組み込みスタイル シートから取得するためのキーASP.NET によって内部的に使用されます。
パブリック フィールド FontSizeKey Font プロパティSize プロパティ使用するスタイルを、組み込みスタイル シートから取得するためのキーASP.NET によって内部的に使用されます。
パブリック フィールド ForeColorKey ForeColor プロパティ使用するスタイル組み込みスタイル シートから取得するためのキーASP.NET によって内部的に使用されます。
パブリック フィールド ItalicKey Font プロパティItalic プロパティ使用するスタイルを、組み込みスタイル シートから取得するためのキーASP.NET によって内部的に使用されます。
パブリック フィールド WrappingKey Wrapping使用するスタイル組み込みスタイル シートから取得するためのキーASP.NET によって内部的に使用されます。
パブリック プロパティパブリック プロパティ
( プロテクト プロパティ参照)
  名前 説明
パブリック プロパティ Alignment スタイルとして適用する配置取得または設定します既定値は Alignment.NotSet です。
パブリック プロパティ BackColor スタイルとして適用する背景色取得または設定します既定値は Color.Empty です。
パブリック プロパティ Control 関連するコントロールへの、厳密に指定され参照返します
パブリック プロパティ DeviceSpecific コントロール関連付ける DeviceSpecific の Choice コンストラクト取得または設定します該当するコンストラクト存在しない場合アクセサnull 参照 (Visual Basic では Nothing) を返します
パブリック プロパティ Font コントロールフォント情報格納している FontInfo オブジェクト返します
パブリック プロパティ ForeColor スタイルとして適用する前景色を取得または設定します。このプロパティは、通常テキストの色を設定します既定値Empty です。
パブリック プロパティ IsTemplated Style オブジェクトアクティブ テンプレート セットがあるかどうかを示す値を取得します
パブリック プロパティ Item オーバーロードされます継承使用不使用かかわらずkey パラメータ通じてスタイル返します
パブリック プロパティ Name 指定したオブジェクトの名前を取得または設定します既定値空の文字列 ("") です。
パブリック プロパティ StyleReference Styleスタイル プロパティへの参照取得または設定します
パブリック プロパティ Wrapping スタイルとして適用する折り返しモード取得または設定します既定値は NotSet です。
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ IsTrackingViewState Style オブジェクトビューステートへの変更保存しているかどうかを示す値を取得します
プロテクト プロパティ State StateBag の現在の内容取得します
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Web.UI.IParserAccessor.AddParsedSubObject このメンバ説明については、「IParserAccessor.AddParsedSubObject」を参照してください
インターフェイスの明示的な実装 System.Web.UI.IStateManager.LoadViewState このメンバ説明については、「IStateManager.LoadViewState」を参照してください
インターフェイスの明示的な実装 System.Web.UI.IStateManager.SaveViewState このメンバ説明については、「IStateManager.SaveViewState」を参照してください
インターフェイスの明示的な実装 System.Web.UI.IStateManager.TrackViewState このメンバ説明については、「IStateManager.TrackViewState」を参照してください
インターフェイスの明示的な実装 System.Web.UI.IStateManager.IsTrackingViewState このメンバ説明については、IStateManager.IsTrackingViewState のトピック参照してください
参照参照

関連項目

Style クラス
System.Web.UI.MobileControls 名前空間
Name

その他の技術情報

StyleSheet コントロール概要

Style メンバ

Web サーバー コントロールスタイル表します

Style データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
( プロテクト プロパティ参照)
  名前 説明
パブリック プロパティ BackColor Web サーバー コントロール背景色取得または設定します
パブリック プロパティ BorderColor Web サーバー コントロール境界線の色を取得または設定します
パブリック プロパティ BorderStyle Web サーバー コントロール境界線スタイル取得または設定します
パブリック プロパティ BorderWidth Web サーバー コントロール境界線の幅を取得または設定します
パブリック プロパティ Container  Component格納している IContainer を取得します。(Component から継承されます。)
パブリック プロパティ CssClass クライアントWeb サーバー コントロールによって表示されるカスケード スタイル シート (CSS: Cascading Style Sheet) クラス取得または設定します
パブリック プロパティ Font Web サーバー コントロール関連付けられたフォント プロパティ取得します
パブリック プロパティ ForeColor Web サーバー コントロール前景色 (通常テキストの色) を取得または設定します
パブリック プロパティ Height Web サーバー コントロールの高さを取得または設定します
パブリック プロパティ IsEmpty 保護されているプロパティスタイル要素が状態バッグ定義されているかどうかを示す値を取得します
パブリック プロパティ RegisteredCssClass コントロール登録されているカスケード スタイル シート (CSS) を取得します
パブリック プロパティ Site  Component の ISite を取得または設定します。(Component から継承されます。)
パブリック プロパティ Width Web サーバー コントロールの幅を取得または設定します
プロテクト プロパティプロテクト プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド AddAttributesToRender オーバーロードされます指定した System.Web.UI.HtmlTextWriter に表示する必要のある HTML 属性およびスタイル追加します。このメソッドは、主にコントロール開発者によって使用されます。
パブリック メソッド CopyFrom 指定した Styleスタイル プロパティをこのメソッド呼び出し元である Style クラスインスタンス複製します
パブリック メソッド CreateObjRef  リモート オブジェクトとの通信使用するプロキシ生成必要な情報をすべて格納しているオブジェクト作成します。 (MarshalByRefObject から継承されます。)
パブリック メソッド Dispose  オーバーロードされますComponent によって使用されているリソース解放します。 (Component から継承されます。)
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 (Object から継承されます。)
パブリック メソッド GetLifetimeService  対象インスタンス有効期間ポリシー制御する現在の有効期間サービス オブジェクト取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド GetStyleAttributes 指定された System.Web.UI.IUrlResolutionService 実装オブジェクトの System.Web.UI.CssStyleCollection オブジェクト取得します
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド InitializeLifetimeService  対象インスタンス有効期間ポリシー制御する有効期間サービス オブジェクト取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド MergeWith 指定した Styleスタイル プロパティをこのメソッド呼び出し元である Style クラスインスタンス結合します
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド Reset 定義されスタイル要素を状態バッグから削除します
パブリック メソッド SetDirty Styleマーク付けて、その状態がビューステート記録されるようにします。
パブリック メソッド ToString  Component の名前を格納している String返します (存在する場合)。このメソッドオーバーライドできません。 (Component から継承されます。)
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド Dispose  オーバーロードされますComponent によって使用されているリソース解放します。 (Component から継承されます。)
プロテクト メソッド FillStyleAttributes 指定されオブジェクトスタイル プロパティSystem.Web.UI.CssStyleCollection オブジェクト追加します
プロテクト メソッド Finalize  Componentガベージ コレクションによってクリアされる前に、アンマネージ リソース解放しその他のクリーンアップ操作実行します。 (Component から継承されます。)
プロテクト メソッド GetService  Component またはその Container提供されるサービスを表すオブジェクト返します。 (Component から継承されます。)
プロテクト メソッド LoadViewState 以前保存した状態を読み込みます。
プロテクト メソッド MemberwiseClone  オーバーロードされます。 ( MarshalByRefObject から継承されます。)
プロテクト メソッド SaveViewState 保護されているメソッド。TrackViewState メソッド呼び出し後に変更された状態をすべて保存します
プロテクト メソッド SetBit 保護されている内部メソッド。状態バッグ格納されているスタイル プロパティを示す内部ビットマスク フィールド設定します
プロテクト メソッド TrackViewState 保護されているメソッド状態変化追跡開始位置コントロールマークします。"マーク" の後で加えられ変更はすべて追跡されコントロールビューステート一部として保存されます。
パブリック イベントパブリック イベント
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Web.UI.IStateManager.LoadViewState 以前保存した状態を読み込みます。
インターフェイスの明示的な実装 System.Web.UI.IStateManager.SaveViewState 状態の変化を示すオブジェクト返します
インターフェイスの明示的な実装 System.Web.UI.IStateManager.TrackViewState 状態変化追跡開始します
インターフェイスの明示的な実装 System.Web.UI.IStateManager.IsTrackingViewState このメンバ説明については、IStateManager.IsTrackingViewState のトピック参照してください
参照参照

関連項目

Style クラス
System.Web.UI.WebControls 名前空間
BackColor
ForeColor
BorderWidth
BorderStyle
BorderColor
Height
Width

その他の技術情報

ASP.NETテーマスキン概要
ASP.NET Web サーバー コントロールCSS スタイル
ASP.NET Web サーバー コントロールブラウザ機能




固有名詞の分類

このページでは「.NET Framework クラス ライブラリ リファレンス」から!-styleを検索した結果を表示しています。
Weblioに収録されているすべての辞書から!-styleを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書から!-style を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

「!-style」に関係したコラム

辞書ショートカット

すべての辞書の索引

「!-style」の関連用語

!-styleのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



!-styleのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS