IStyleSheet.CreateStyleRule メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > IStyleSheet.CreateStyleRule メソッドの意味・解説 

IStyleSheet.CreateStyleRule メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

クラスによって実装された場合は、指定されドキュメント言語要素型つまりセレクタに対してスタイル ルール作成します

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

Sub CreateStyleRule ( _
    style As Style, _
    urlResolver As IUrlResolutionService, _
    selector As String _
)
Dim instance As IStyleSheet
Dim style As Style
Dim urlResolver As IUrlResolutionService
Dim selector As String

instance.CreateStyleRule(style, urlResolver, selector)
void CreateStyleRule (
    Style style,
    IUrlResolutionService urlResolver,
    string selector
)
void CreateStyleRule (
    Style^ style, 
    IUrlResolutionService^ urlResolver, 
    String^ selector
)
void CreateStyleRule (
    Style style, 
    IUrlResolutionService urlResolver, 
    String selector
)
function CreateStyleRule (
    style : Style, 
    urlResolver : IUrlResolutionService, 
    selector : String
)

パラメータ

style

埋め込みスタイル シート追加されるスタイル ルール

urlResolver

現在の場所 (URL) のコンテキスト情報格納している IUrlResolutionService 実装オブジェクト

selector

スタイル影響を受ける HTML ページ部分

解説解説
使用例使用例

IStyleSheet の Header 実装使用して新しStyle オブジェクトである bodyStyle定義するコード例次に示しますbodyStyleCreateStyleRule呼び出すことにより、現在の URL追加されます。

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
  
  Sub Page_Load(ByVal sender As
 Object, ByVal e As EventArgs)
  
    If Not Page.Header Is
 Nothing Then
    
      ' Create a Style object for the <BODY> section of the Web
 page.
      Dim bodyStyle As Style = New
 Style()

      bodyStyle.ForeColor = System.Drawing.Color.Blue
      bodyStyle.BackColor = System.Drawing.Color.LightGray

      ' Add the style to the header of the current page.
      Page.Header.StyleSheet.CreateStyleRule(bodyStyle, me, "BODY")

      ' Add text to the label2 control to see the style rules applied
 to it.
      label1.Text = "This is what the bodyStyle looks like."
      
    End If
    
  End Sub


</script>

<html  >
<head id="head1" runat="server"
 />
  <body>
    <form id="form1" runat="server">
        <h1>IStyleSheet Example</h1>
        <asp:Label 
          id="label1" 
          runat="server">
        </asp:Label>
    </form>
  </body>
</html>
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  void Page_Load(object sender, EventArgs e)
  {
    if (Page.Header != null)
    {
      // Create a Style object for the <BODY> section of the Web
 page.
      Style bodyStyle = new Style();

      bodyStyle.ForeColor = System.Drawing.Color.Blue;
      bodyStyle.BackColor = System.Drawing.Color.LightGray;

      // Add the style to the header of the current page.
      Page.Header.StyleSheet.CreateStyleRule(bodyStyle, this,
 "BODY");

      // Add text to the label2 control to see the style rules applied
 to it.
      label1.Text = "This is what the bodyStyle looks like.";
    }
  }

</script>

<html  >
<head id="head1" runat="server" />
  <body>
    <form id="form1" runat="server">
        <h1>IStyleSheet Example</h1>
        <asp:Label 
          id="label1" 
          runat="server">
        </asp:Label>
    </form>
  </body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IStyleSheet インターフェイス
IStyleSheet メンバ
System.Web.UI 名前空間


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

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

辞書ショートカット

すべての辞書の索引

IStyleSheet.CreateStyleRule メソッドのお隣キーワード
検索ランキング

   

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



IStyleSheet.CreateStyleRule メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS