Blend.Positions プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Blend.Positions プロパティの意味・解説 

Blend.Positions プロパティ

グラデーションブレンド位置配列取得または設定します

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

解説解説

この配列要素によって、グラデーション ライン沿った距離の割合指定されます。たとえば、要素の値が 0.2f の場合は、開始位置から全距離の 20%位置であることが指定されます。この配列要素は、0.0f ~ 1.0f の浮動小数点値で表されます。配列最初要素は 0.0f、最後要素は 1.0f になっている必要があります

使用例使用例

Factors プロパティPositions プロパティ設定してBlend クラス使用するコード例次に示します。この例は、Windows フォームでの使用意図してデザインされています。System.Drawing.Drawing2D 名前空間インポートされているフォームコード貼り付けます。フォームPaint イベント処理しDemonstrateBlend メソッド呼び出しe を PaintEventArgs 値として渡します

Private Sub DemonstrateBlend(ByVal
 e As PaintEventArgs)
    Dim blend1 As New Blend(9)

    ' Set the values in the Factors array to be all green, 
    ' go to all blue, and then go back to green.
    blend1.Factors = New Single() {0.0F, 0.2F,
 0.5F, 0.7F, 1.0F, _
        0.7F, 0.5F, 0.2F, 0.0F}

    ' Set the positions.
    blend1.Positions = New Single() {0.0F,
 0.1F, 0.3F, 0.4F, 0.5F, _
        0.6F, 0.7F, 0.8F, 1.0F}

    ' Declare a rectangle to draw the Blend in.
    Dim rectangle1 As New
 Rectangle(10, 10, 120, 100)

    ' Create a new LinearGradientBrush using the rectangle, 
    ' green and blue. and 90-degree angle.
    Dim brush1 As New LinearGradientBrush(rectangle1,
 _
        Color.LightGreen, Color.Blue, 90, True)

    ' Set the Blend property on the brush to the custom blend.
    brush1.Blend = blend1

    ' Fill in an ellipse with the brush.
    e.Graphics.FillEllipse(brush1, rectangle1)

    ' Dispose of the custom brush.
    brush1.Dispose()
End Sub
private void DemonstrateBlend(PaintEventArgs
 e)
{
    Blend blend1 = new Blend(9);

    // Set the values in the Factors array to be all green, 
    // go to all blue, and then go back to green.
    blend1.Factors = new float[]{0.0F, 0.2F,
 0.5F, 0.7F, 1.0F, 
                                    0.7F, 0.5F, 0.2F, 0.0F};

    // Set the positions.
    blend1.Positions = 
        new float[]{0.0F, 0.1F, 0.3F, 0.4F,
 0.5F, 0.6F, 
        0.7F, 0.8F, 1.0F};

    // Declare a rectangle to draw the Blend in.
    Rectangle rectangle1 = new Rectangle(10, 10, 120, 100);

    // Create a new LinearGradientBrush using the rectangle, 
    // green and blue. and 90-degree angle.
    LinearGradientBrush brush1 = 
        new LinearGradientBrush(rectangle1, Color.LightGreen,
 
        Color.Blue, 90, true);

    // Set the Blend property on the brush to the custom blend.
    brush1.Blend = blend1;

    // Fill in an ellipse with the brush.
    e.Graphics.FillEllipse(brush1, rectangle1);

    // Dispose of the custom brush.
    brush1.Dispose();
}
private:
   void DemonstrateBlend( PaintEventArgs^ e )
   {
      Blend^ blend1 = gcnew Blend( 9 );

      // Set the values in the Factors array to be all green, 
      // go to all blue, and then go back to green.
      array<Single>^temp0 = {0.0F,0.2F,0.5F,0.7F,1.0F,0.7F,0.5F,0.2F,0.0F};
      blend1->Factors = temp0;

      // Set the positions.
      array<Single>^temp1 = {0.0F,0.1F,0.3F,0.4F,0.5F,0.6F,0.7F,0.8F,1.0F};
      blend1->Positions = temp1;

      // Declare a rectangle to draw the Blend in.
      Rectangle rectangle1 = Rectangle(10,10,120,100);

      // Create a new LinearGradientBrush using the rectangle, 
      // green and blue. and 90-degree angle.
      LinearGradientBrush^ brush1 = gcnew LinearGradientBrush( rectangle1,Color::LightGreen,Color::Blue,90,true
 );

      // Set the Blend property on the brush to the custom blend.
      brush1->Blend = blend1;

      // Fill in an ellipse with the brush.
      e->Graphics->FillEllipse( brush1, rectangle1 );

      // Dispose of the custom brush.
      delete brush1;
   }
private void DemonstrateBlend(PaintEventArgs
 e)
{
    Blend blend1 = new Blend(9);

    // Set the values in the Factors array to be all green, 
    // go to all blue, and then go back to green.
    blend1.set_Factors(new float[] { 0.0F,
 0.2F, 0.5F, 0.7F, 1.0F, 0.7F,
        0.5F, 0.2F, 0.0F });

    // Set the positions.
    blend1.set_Positions(new float[] { 0.0F,
 0.1F, 0.3F, 0.4F, 0.5F, 0.6F,
        0.7F, 0.8F, 1.0F });

    // Declare a rectangle to draw the Blend in.
    Rectangle rectangle1 = new Rectangle(10, 10, 120, 100);

    // Create a new LinearGradientBrush using the rectangle, 
    // green and blue. and 90-degree angle.
    LinearGradientBrush brush1 = new LinearGradientBrush(rectangle1
,
                                Color.get_LightGreen(), Color.get_Blue(),
                                90, true);

    // Set the Blend property on the brush to the custom blend.
    brush1.set_Blend(blend1);

    // Fill in an ellipse with the brush.
    e.get_Graphics().FillEllipse(brush1, rectangle1);

    // Dispose of the custom brush.
    brush1.Dispose();
} //DemonstrateBlend


プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

Blend.Positions プロパティのお隣キーワード
検索ランキング

   

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



Blend.Positions プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS