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

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

ColorTranslator.ToHtml メソッド

指定した Color 構造体HTML カラー文字列形式変換します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

解説解説

このメソッドは、Color 構造体HTML カラー文字列形式変換します。これは "Red"、"Blue"、"Green" など、最もよく使用される色の名前であり、"FF33AA" などの数値によるカラー値ではありません。

使用例使用例

次の例は、Windows フォームでの使用意図してデザインされており、Paint イベント ハンドラパラメータである PaintEventArgse が必要です。このコードでは、Color 構造体HTML カラー文字列形式変換しメッセージ ボックスにその文字列表示します

Public Sub ToHtml_Example(ByVal
 e As PaintEventArgs)

    ' Create an instance of a Color structure.
    Dim myColor As Color = Color.Red

    ' Translate myColor to an HTML color.
    Dim htmlColor As String
 = ColorTranslator.ToHtml(myColor)

    ' Show a message box with the value of htmlColor.
    MessageBox.Show(htmlColor)
End Sub
public void ToHtml_Example(PaintEventArgs e)
{
    // Create an instance of a Color structure.
    Color myColor = Color.Red;
             
    // Translate myColor to an HTML color.
    string htmlColor = ColorTranslator.ToHtml(myColor);
             
    // Show a message box with the value of htmlColor.
    MessageBox.Show(htmlColor);
}
public:
   void ToHtml_Example( PaintEventArgs^ /*e*/ )
   {
      // Create an instance of a Color structure.
      Color myColor = Color::Red;

      // Translate myColor to an HTML color.
      String^ htmlColor = ColorTranslator::ToHtml( myColor );

      // Show a message box with the value of htmlColor.
      MessageBox::Show( htmlColor );
   }
public void ToHtml_Example(PaintEventArgs e)
{
    // Create an instance of a Color structure.
    Color myColor = Color.get_Red();

    // Translate myColor to an HTML color.
    String htmlColor = ColorTranslator.ToHtml(myColor);

    // Show a message box with the value of htmlColor.
    MessageBox.Show(htmlColor);
} //ToHtml_Example
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS