StyleSheet クラスとは? わかりやすく解説

StyleSheet クラス

他のコントロール適用されるスタイル整理します

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

Public Class StyleSheet
    Inherits MobileControl
public class StyleSheet : MobileControl
public class StyleSheet extends MobileControl
public class StyleSheet extends
 MobileControl
解説解説
使用例使用例

Page_Load イベント実行中に Style プロパティStyleSheet コントロール追加する方法の例を次に示します

<%@ Page Language="VB" 
    Inherits="System.Web.UI.MobileControls.MobilePage"
 %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls"
 
    Assembly="System.Web.Mobile"
 %>
<%@ Import Namespace="System.Web.UI.MobileControls"
 %>
<%@ Import Namespace="System.Drawing"
 %>

<script runat="server">
    Protected Sub Page_Load(ByVal
 sender As Object, ByVal
 e As EventArgs)
        If Not IsPostBack Then
            StyleSheet1("Style1").ForeColor = Color.Red
            StyleSheet1("Style1").Font.Size = _
                System.Web.UI.MobileControls.FontSize.Large
            StyleSheet1("Style1").Font.Bold = BooleanOption.True
            StyleSheet1("Style1").Font.Italic = BooleanOption.True
            StyleSheet1("Style2").ForeColor = Color.Blue
            StyleSheet1("Style2").Font.Size = _
                System.Web.UI.MobileControls.FontSize.Normal
            StyleSheet1("Style2").Font.Bold = BooleanOption.False
            StyleSheet1("Style2").Font.Italic = BooleanOption.True
            StyleSheet1("Style3").ForeColor = Color.Green
            StyleSheet1("Style3").Font.Size = _
                System.Web.UI.MobileControls.FontSize.Small
            StyleSheet1("Style3").Font.Bold = BooleanOption.False
            StyleSheet1("Style3").Font.Italic = BooleanOption.False
        End If
    End Sub

    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 Name="Style1" Font-Name="Arial"
            BackColor="#E0E0E0" Wrapping="Wrap">
        </mobile:Style>
        <mobile:Style Name="Style2" Font-Name="Arial"
            BackColor="blue" Wrapping="NoWrap">
        </mobile:Style>
        <mobile:Style Name="Style3" Font-Name="Arial
 Narrow"
            BackColor="Green" Wrapping="NoWrap">
        </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" %>
<%@ Import Namespace="System.Web.UI.MobileControls" %>
<%@ Import Namespace="System.Drawing" %>

<script runat="server">
    protected void Page_Load(Object sender,
 EventArgs e)
    {
        if (!IsPostBack)
        {
            StyleSheet1["Style1"].ForeColor = Color.Red;
            StyleSheet1["Style1"].Font.Size = 
                System.Web.UI.MobileControls.FontSize.Large;
            StyleSheet1["Style1"].Font.Bold = BooleanOption.True;
            StyleSheet1["Style1"].Font.Italic = BooleanOption.True;
            StyleSheet1["Style2"].ForeColor = Color.Blue;
            StyleSheet1["Style2"].Font.Size = 
                System.Web.UI.MobileControls.FontSize.Normal;
            StyleSheet1["Style2"].Font.Bold = BooleanOption.False;
            StyleSheet1["Style2"].Font.Italic = BooleanOption.True;
            StyleSheet1["Style3"].ForeColor = Color.Green;
            StyleSheet1["Style3"].Font.Size = 
                System.Web.UI.MobileControls.FontSize.Small;
            StyleSheet1["Style3"].Font.Bold = BooleanOption.False;
            StyleSheet1["Style3"].Font.Italic = BooleanOption.False;
        }
    }

    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 Name="Style1" Font-Name="Arial"
            BackColor="#E0E0E0" Wrapping="Wrap">
        </mobile:Style>
        <mobile:Style Name="Style2" Font-Name="Arial"
            BackColor="blue" Wrapping="NoWrap">
        </mobile:Style>
        <mobile:Style Name="Style3" Font-Name="Arial Narrow"
            BackColor="Green" Wrapping="NoWrap">
        </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>
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.MobileControls.MobileControl
      System.Web.UI.MobileControls.StyleSheet
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「StyleSheet クラス」の関連用語

StyleSheet クラスのお隣キーワード
検索ランキング

   

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



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

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

©2024 GRAS Group, Inc.RSS