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

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

HtmlTextWriter.GetStyleName メソッド

指定した HtmlTextWriterStyle 列挙値に関連付けられたマークアップ スタイル属性名を取得します

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

Protected Function GetStyleName ( _
    styleKey As HtmlTextWriterStyle _
) As String
Dim styleKey As HtmlTextWriterStyle
Dim returnValue As String

returnValue = Me.GetStyleName(styleKey)
protected string GetStyleName (
    HtmlTextWriterStyle styleKey
)
protected:
String^ GetStyleName (
    HtmlTextWriterStyle styleKey
)
protected String GetStyleName (
    HtmlTextWriterStyle styleKey
)
protected function GetStyleName (
    styleKey : HtmlTextWriterStyle
) : String

パラメータ

styleKey

スタイル属性名の取得対象の HtmlTextWriterStyle。

戻り値
styleKey指定されHtmlTextWriterStyle 列挙値に関連付けられたスタイル属性名。

解説解説

styleKey有効な HtmlTextWriterStyle オブジェクトではない場合GetStyleName メソッド空の文字列 ("") を返します

使用例使用例

<label> 要素出力するかどうかチェックする方法次のコード例示します出力する場合は、Color スタイル属性要素定義されているかどうかチェックします属性定義されていない場合は、AddStyleAttribute メソッド呼び出されGetStyleName メソッドColor 列挙メンバ文字列形式変換しAddStyleAttribute メソッド渡します

' If the markup element being rendered is a Label,
' render the opening tag of a Font element before it.
If tagKey = HtmlTextWriterTag.Label Then
    ' Check whether a Color style attribute is 
    ' included on the Label. If not, use the
    ' AddStyleAttribute and GetStyleName methods to add one
    ' and set its value to red.
    If Not IsStyleAttributeDefined(HtmlTextWriterStyle.Color)
 Then
        AddStyleAttribute(GetStyleName(HtmlTextWriterStyle.Color), "red")
    End If
// If the markup element being rendered is a Label,
// render the opening tag of a Font element before it.
if (tagKey == HtmlTextWriterTag.Label)
{
    // Check whether a Color style attribute is 
    // included on the Label. If not, use the
    // AddStyleAttribute and GetStyleName methods to add one
    // and set its value to red.
    if (!IsStyleAttributeDefined(HtmlTextWriterStyle.Color))
    {
        AddStyleAttribute(GetStyleName(HtmlTextWriterStyle.Color), "red");
    }
// If the markup element being rendered is a Label,
// render the opening tag of a <Font> element before it.
if ( tagKey == HtmlTextWriterTag::Label )
{
   
   // Check whether a Color style attribute is
   // included on the Label. If not, use the
   // AddStyleAttribute and GetStyleName methods to add one
   // and set its value to red.
   if (  !IsStyleAttributeDefined( HtmlTextWriterStyle::Color
 ) )
   {
      AddStyleAttribute( GetStyleName( HtmlTextWriterStyle::Color ), "red"
 );
   }

// If the markup element being rendered is a Label,
// render the opening tag of a Font element before it.
if (tagKey.Equals(HtmlTextWriterTag.Label)) {
    // Check whether a Color style attribute is 
    // included on the Label. If not, use the
    // AddStyleAttribute and GetStyleName methods to add one
    // and set its value to red.
    if (!(IsStyleAttributeDefined(HtmlTextWriterStyle.Color)))
 {
        AddStyleAttribute(GetStyleName(HtmlTextWriterStyle.Color), 
            "red");
    }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HtmlTextWriter クラス
HtmlTextWriter メンバ
System.Web.UI 名前空間
TextWriter
HtmlTextWriterStyle
AddStyleAttribute


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS