中心の色、および両端の単色への線形の減色が設定されている線形グラデーションを作成します。
Overloads Public Sub SetBlendTriangularShape( _
ByVal focus As Single, _ ByVal scale As Single _)
[C#]
public void SetBlendTriangularShape(floatfocus,floatscale);
[C++]
public: void SetBlendTriangularShape(floatfocus,floatscale);
[JScript]
public function SetBlendTriangularShape(
focus : float,scale : float);
パラメータ
- focus
グラデーションの中心 (グラデーションの終了色だけで構成される点) を指定する 0 ~ 1 の値。 - scale
開始色から focus 終了色へ変化する度合いを指定する 0 ~ 1 の値。
解説
このメソッドは、グラデーションの中で終了色だけで構成されている点である focus を指定します。 focus パラメータは、グラデーション線に沿った距離の比率として位置を表します。線形に両端で開始色に戻るグラデーションになります。
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 OnPaint イベントのオブジェクトである PaintEventArgs e が必要です。このコードは次のアクションを実行します。
- 新しい LinearGradientBrush オブジェクトを作成します。
- このブラシを使用して、左から右へ線形に色が変化するグラデーションを持つ楕円を画面に描画します。
- LinearGradientBrush オブジェクトを、中央に頂点のある三角形に変換します。
- 変換されたブラシを使用して、画面に 2 番目の楕円を描画します。
[Visual Basic, C#] 下の楕円のグラデーションは、青から赤に変化し、さらに青に戻ります。
Public Sub SetBlendTriangularShapeExample(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, 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, 1F)
' Use the triangular brush to draw a second ellipse.
myRect.Y = 150
e.Graphics.FillEllipse(myLGBrush, myRect)
End Sub
[C#]
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);
}
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
LinearGradientBrush クラス | LinearGradientBrush メンバ | System.Drawing.Drawing2D 名前空間 | LinearGradientBrush.SetBlendTriangularShape オーバーロードの一覧