LinearGradientBrush.SetBlendTriangularShape メソッド

定義

中心の色、および両端の単色への線形の減色が設定されている線形グラデーションを作成します。

オーバーロード

SetBlendTriangularShape(Single)

中心の色、および両端の単色への線形の減色が設定されている線形グラデーションを作成します。

SetBlendTriangularShape(Single, Single)

中心の色、および両端の単色への線形の減色が設定されている線形グラデーションを作成します。

SetBlendTriangularShape(Single)

ソース:
LinearGradientBrush.cs
ソース:
LinearGradientBrush.cs
ソース:
LinearGradientBrush.cs

中心の色、および両端の単色への線形の減色が設定されている線形グラデーションを作成します。

public:
 void SetBlendTriangularShape(float focus);
public void SetBlendTriangularShape (float focus);
member this.SetBlendTriangularShape : single -> unit
Public Sub SetBlendTriangularShape (focus As Single)

パラメーター

focus
Single

グラデーションの中心 (グラデーションの終了色だけで構成される点) を指定する 0 から 1 の値。

例については、「SetBlendTriangularShape」を参照してください。

注釈

このメソッドは、 を focus指定します。これは、グラデーションが終了色のみで構成されるポイントです。 パラメーターは focus 、グラデーション線に沿った距離の割合として位置を表します。 グラデーションは、どちらの側にも直線的に開始色に落ちます。

適用対象

SetBlendTriangularShape(Single, Single)

ソース:
LinearGradientBrush.cs
ソース:
LinearGradientBrush.cs
ソース:
LinearGradientBrush.cs

中心の色、および両端の単色への線形の減色が設定されている線形グラデーションを作成します。

public:
 void SetBlendTriangularShape(float focus, float scale);
public void SetBlendTriangularShape (float focus, float scale);
member this.SetBlendTriangularShape : single * single -> unit
Public Sub SetBlendTriangularShape (focus As Single, scale As Single)

パラメーター

focus
Single

グラデーションの中心 (グラデーションの終了色だけで構成される点) を指定する 0 から 1 の値。

scale
Single

開始色から focus 終了色へ変化する度合いを指定する 0 ~ 1 の値。

次のコード例は、Windows フォームで使用するように設計されており、イベント オブジェクトがOnPaint必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • 新しい LinearGradientBrush を作成します。

  • このブラシを使用して、色の線形の左から右への遷移がある画面に楕円を描画します。

  • LinearGradientBrush 中心にピークを持つ三角形の図形に変換します。

  • 変換されたブラシを使用して、画面に 2 番目の楕円を描画します。

下の楕円のグラデーションは青から赤に、次に青に戻ります。

private:
   void SetBlendTriangularShapeExample( PaintEventArgs^ e )
   {
      // Create a LinearGradientBrush.
      Rectangle myRect = Rectangle(20,20,200,100);
      LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true );

      // Draw an ellipse to the screen using the LinearGradientBrush.
      e->Graphics->FillEllipse( myLGBrush, myRect );

      // Create a triangular shaped brush with the peak at the center
      // of the drawing area.
      myLGBrush->SetBlendTriangularShape( .5f, 1.0f );

      // Use the triangular brush to draw a second ellipse.
      myRect.Y = 150;
      e->Graphics->FillEllipse( myLGBrush, myRect );
   }
private void SetBlendTriangularShapeExample(PaintEventArgs e)
{
             
    // Create a LinearGradientBrush.
    Rectangle myRect = new Rectangle(20, 20, 200, 100);
    LinearGradientBrush myLGBrush = new LinearGradientBrush(
        myRect, Color.Blue, Color.Red,  0.0f, true);
             
    // Draw an ellipse to the screen using the LinearGradientBrush.
    e.Graphics.FillEllipse(myLGBrush, myRect);
             
    // Create a triangular shaped brush with the peak at the center
    // of the drawing area.
    myLGBrush.SetBlendTriangularShape(.5f, 1.0f);
             
    // Use the triangular brush to draw a second ellipse.
    myRect.Y = 150;
    e.Graphics.FillEllipse(myLGBrush, myRect);
}
Public Sub SetBlendTriangularShapeExample(ByVal e As PaintEventArgs)

    ' Create a LinearGradientBrush.
    Dim myRect As New Rectangle(20, 20, 200, 100)
    Dim myLGBrush As New LinearGradientBrush(myRect, Color.Blue, _
    Color.Red, 0.0F, True)

    ' Draw an ellipse to the screen using the LinearGradientBrush.
    e.Graphics.FillEllipse(myLGBrush, myRect)

    ' Create a triangular shaped brush with the peak at the center

    ' of the drawing area.
    myLGBrush.SetBlendTriangularShape(0.5F, 1.0F)

    ' Use the triangular brush to draw a second ellipse.
    myRect.Y = 150
    e.Graphics.FillEllipse(myLGBrush, myRect)
End Sub

注釈

このメソッドは、 を focus指定します。これは、グラデーションが終了色のみで構成されるポイントです。 パラメーターは focus 、グラデーション線に沿った距離の割合として位置を表します。 グラデーションは、どちらの側にも直線的に開始色に落ちます。

適用対象