ColorBlend クラス
アセンブリ: System.Drawing (system.drawing.dll 内)


System.Drawing.Drawing2D.ColorBlend


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ColorBlend コンストラクタ ()
アセンブリ: System.Drawing (system.drawing.dll 内)


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

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ColorBlend コンストラクタ (Int32)
アセンブリ: System.Drawing (system.drawing.dll 内)



Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ColorBlend コンストラクタ

名前 | 説明 |
---|---|
ColorBlend () | ColorBlend クラスの新しいインスタンスを初期化します。 |
ColorBlend (Int32) | 指定した色の数と位置の数を使用して、ColorBlend クラスの新しいインスタンスを初期化します。 |

ColorBlend プロパティ
ColorBlend メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

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



名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- ColorBlendのページへのリンク