ColorBlendとは? わかりやすく解説

ColorBlend クラス


ColorBlend コンストラクタ ()

ColorBlend クラスの新しいインスタンスを初期化します。

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

public ColorBlend ()
public:
ColorBlend ()
public ColorBlend ()
使用例使用例

Windows フォーム環境で使用するための例を次に示します。ColorBlend クラスを LinearGradientBrush クラスと組み合わせて使用し、ブレンドされた楕円を画面に描画する方法を示しています。この楕円は左側が緑で、色のブレンドによって黄色になってから青になり、最後に右側で赤になります。これは、Colors プロパティと Positions プロパティで使用される myColors 配列と myPositions 配列の設定によって行われます。lgBrush2 という名前の LinearGradientBrush オブジェクトの InterpolationColors プロパティは、ColorBlend オブジェクトの myBlend と等価になっている必要があります。

Protected Overrides Sub
 OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
    ' Draw ellipse using ColorBlend.
    Dim startPoint2 As New
 Point(20, 110)
    Dim endPoint2 As New
 Point(140, 110)
    Dim myColors As Color() = {Color.Green,
 Color.Yellow, _
    Color.Yellow, Color.Blue, Color.Red, Color.Red}
    Dim myPositions As Single()
 = {0.0F, 0.2F, 0.4F, 0.6F, 0.8F, 1.0F}
    Dim myBlend As New ColorBlend
    myBlend.Colors = myColors
    myBlend.Positions = myPositions
    Dim lgBrush2 As New
 LinearGradientBrush(startPoint2, endPoint2, _
    Color.Green, Color.Red)
    lgBrush2.InterpolationColors = myBlend
    Dim ellipseRect2 As New
 Rectangle(20, 110, 120, 80)
    e.Graphics.FillEllipse(lgBrush2, ellipseRect2)
End Sub
protected override void OnPaint(PaintEventArgs
 e)
{
             
    //Draw ellipse using ColorBlend.
    Point startPoint2 = new Point(20, 110);
    Point endPoint2 = new Point(140, 110);
    Color[] myColors = {Color.Green,
                           Color.Yellow,
                           Color.Yellow,
                           Color.Blue,
                           Color.Red,
                           Color.Red};
    float[] myPositions = {0.0f,.20f,.40f,.60f,.80f,1.0f};
    ColorBlend myBlend = new ColorBlend();
    myBlend.Colors = myColors;
    myBlend.Positions = myPositions;
    LinearGradientBrush lgBrush2 = new LinearGradientBrush(startPoint2
,
        endPoint2,
        Color.Green,
        Color.Red);
    lgBrush2.InterpolationColors = myBlend;
    Rectangle ellipseRect2 = new Rectangle(20, 110, 120, 80);
    e.Graphics.FillEllipse(lgBrush2, ellipseRect2);
}
protected:
   virtual void OnPaint( PaintEventArgs^ e ) override
   {
      //Draw ellipse using ColorBlend.
      Point startPoint2 = Point(20,110);
      Point endPoint2 = Point(140,110);
      array<Color>^ myColors =
            {Color::Green,Color::Yellow,Color::Yellow,Color::Blue,Color::Red,Color::Red};
      array<Single>^myPositions = {0.0f,.20f,.40f,.60f,.80f,1.0f};
      ColorBlend^ myBlend = gcnew ColorBlend;
      myBlend->Colors = myColors;
      myBlend->Positions = myPositions;
      LinearGradientBrush^ lgBrush2 =
            gcnew LinearGradientBrush( startPoint2,endPoint2,Color::Green,Color::Red
 );
      lgBrush2->InterpolationColors = myBlend;
      Rectangle ellipseRect2 = Rectangle(20,110,120,80);
      e->Graphics->FillEllipse( lgBrush2, ellipseRect2 );
   }
protected void OnPaint(PaintEventArgs e)
{
    //Draw ellipse using ColorBlend.
    Point startPoint2 = new Point(20, 110);
    Point endPoint2 = new Point(140, 110);
    Color myColors[] = { Color.get_Green(), Color.get_Yellow(), 
                        Color.get_Yellow(), Color.get_Blue(), 
                        Color.get_Red(), Color.get_Red() };
    float myPositions[] =  { 0.0F, 0.2F, 0.4F, 0.6F, 0.8F, 1.0F
 };
    ColorBlend myBlend = new ColorBlend();

    myBlend.set_Colors(myColors);
    myBlend.set_Positions(myPositions);

    LinearGradientBrush lgBrush2 = new LinearGradientBrush(startPoint2
, 
        endPoint2, Color.get_Green(), Color.get_Red());

    lgBrush2.set_InterpolationColors(myBlend);

    Rectangle ellipseRect2 = new Rectangle(20, 110, 120, 80);

    e.get_Graphics().FillEllipse(lgBrush2, ellipseRect2);
} //OnPaint
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ColorBlend クラス
ColorBlend メンバ
System.Drawing.Drawing2D 名前空間

ColorBlend コンストラクタ (Int32)


ColorBlend コンストラクタ

ColorBlend クラスの新しいインスタンスを初期化します。
オーバーロードの一覧オーバーロードの一覧

参照参照

関連項目

ColorBlend クラス
ColorBlend メンバ
System.Drawing.Drawing2D 名前空間

ColorBlend プロパティ


ColorBlend メソッド


ColorBlend メンバ

多色グラデーションの色のブレンドの補間に使用される、色と位置の配列を定義します。このクラスは継承できません。

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


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

ColorBlend クラス
System.Drawing.Drawing2D 名前空間



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「ColorBlend」の関連用語

ColorBlendのお隣キーワード
検索ランキング

   

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



ColorBlendのページの著作権

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

©2026 GRAS Group, Inc.RSS