Aracılığıyla paylaş


PathGradientBrush.SetBlendTriangularShape Yöntem

Tanım

Orta rengi olan bir gradyan ve çevreleyen bir renge doğrusal bir düşüş oluşturur.

Aşırı Yüklemeler

SetBlendTriangularShape(Single)

Orta rengi olan bir gradyan ve çevreleyen bir renge doğrusal bir düşüş oluşturur.

SetBlendTriangularShape(Single, Single)

Orta renkli bir gradyan ve çevresindeki her renge doğrusal bir düşüş oluşturur.

SetBlendTriangularShape(Single)

Kaynak:
PathGradientBrush.cs
Kaynak:
PathGradientBrush.cs
Kaynak:
PathGradientBrush.cs

Orta rengi olan bir gradyan ve çevreleyen bir renge doğrusal bir düşüş oluşturur.

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

Parametreler

focus
Single

0 ile 1 arasındaki değer, yolun ortasından yolun sınırına kadar herhangi bir radyal boyunca orta rengin en yüksek yoğunluğunda olacağını belirtir. 1 değeri (varsayılan) en yüksek yoğunluğu yolun ortasına yerleştirir.

Örnekler

Bir örnek için bkz. SetBlendTriangularShape.

Açıklamalar

Dizide SurroundColors birden fazla renk varsa, dizideki ilk renk bitiş rengi için kullanılır. Bu dizide belirtilen renkler fırçanın sınır yolundaki ayrık noktalar için kullanılır.

Şunlara uygulanır

SetBlendTriangularShape(Single, Single)

Kaynak:
PathGradientBrush.cs
Kaynak:
PathGradientBrush.cs
Kaynak:
PathGradientBrush.cs

Orta renkli bir gradyan ve çevresindeki her renge doğrusal bir düşüş oluşturur.

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)

Parametreler

focus
Single

0 ile 1 arasındaki değer, yolun ortasından yolun sınırına kadar herhangi bir radyal boyunca orta rengin en yüksek yoğunluğunda olacağını belirtir. 1 değeri (varsayılan) en yüksek yoğunluğu yolun ortasına yerleştirir.

scale
Single

Sınır rengiyle karıştırılan orta rengin maksimum yoğunluğunu belirten 0 ile 1 arasında bir değer. 1 değeri, orta rengin mümkün olan en yüksek yoğunluğuna neden olur ve varsayılan değerdir.

Örnekler

Aşağıdaki kod örneği, Windows Forms ile kullanılmak üzere tasarlanmıştır ve bir OnPaint olay nesnesi gerektirir.PaintEventArgse Kod aşağıdaki eylemleri gerçekleştirir:

  • Bir grafik yolu oluşturur ve buna bir dikdörtgen ekler.

  • Yol noktalarından bir PathGradientBrush oluşturur (bu örnekte, noktalar bir dikdörtgen oluşturur, ancak çoğu şekil olabilir).

  • Orta rengi kırmızıya, çevresindeki rengi maviye ayarlar.

  • Blend dönüşümünü PathGradientBrush uygulamadan önce öğesini ekrana çizer.

  • Yöntemini kullanarak blend dönüşümünü fırçaya SetBlendTriangularShape uygular.

  • Fırça dikdörtgenini TranslateTransform , ekrana daha önce çizilen dikdörtgeni kaplamaması için taşımak için yöntemini çağırır.

  • Dönüştürülen fırça dikdörtgeninin ekrana çizilir.

En büyük orta rengin (kırmızı) yolun ortasından yol sınırına kadar yarı yolda bulunduğuna dikkat edin.

public:
   void SetBlendTriangularShapeExample( PaintEventArgs^ e )
   {
      // Create a graphics path and add a rectangle.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      Rectangle rect = Rectangle(100,20,100,50);
      myPath->AddRectangle( rect );

      // Get the path's array of points.
      array<PointF>^myPathPointArray = myPath->PathPoints;

      // Create a path gradient brush.
      PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray );

      // Set the color span.
      myPGBrush->CenterColor = Color::Red;
      array<Color>^ mySurroundColor = {Color::Blue};
      myPGBrush->SurroundColors = mySurroundColor;

      // Draw the brush to the screen prior to the blend.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );

      // Set the Blend factors.
      myPGBrush->SetBlendTriangularShape( 0.5f, 1.0f );

      // Move the brush down by 100 by Applying the translate
      // transform to the brush.
      myPGBrush->TranslateTransform( 0, 100, MatrixOrder::Append );

      // Draw the brush to the screen again after applying the
      // transforms.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 );
   }
public void SetBlendTriangularShapeExample(PaintEventArgs e)
{
             
    // Create a graphics path and add a rectangle.
    GraphicsPath myPath = new GraphicsPath();
    Rectangle rect = new Rectangle(100, 20, 100, 50);
    myPath.AddRectangle(rect);
             
    // Get the path's array of points.
    PointF[] myPathPointArray = myPath.PathPoints;
             
    // Create a path gradient brush.
    PathGradientBrush myPGBrush = new
        PathGradientBrush(myPathPointArray);
             
    // Set the color span.
    myPGBrush.CenterColor = Color.Red;
    Color[] mySurroundColor = {Color.Blue};
    myPGBrush.SurroundColors = mySurroundColor;
             
    // Draw the brush to the screen prior to the blend.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);
             
    // Set the Blend factors.
    myPGBrush.SetBlendTriangularShape(0.5f, 1.0f);
             
    // Move the brush down by 100 by Applying the translate
    // transform to the brush.
    myPGBrush.TranslateTransform(0, 100, MatrixOrder.Append);
             
    // Draw the brush to the screen again after applying the
    // transforms.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300);
}
Public Sub SetBlendTriangularShapeExample(ByVal e As PaintEventArgs)

    ' Create a graphics path and add a rectangle.
    Dim myPath As New GraphicsPath
    Dim rect As New Rectangle(100, 20, 100, 50)
    myPath.AddRectangle(rect)

    ' Get the path's array of points.
    Dim myPathPointArray As PointF() = myPath.PathPoints

    ' Create a path gradient brush.
    Dim myPGBrush As New PathGradientBrush(myPathPointArray)

    ' Set the color span.
    myPGBrush.CenterColor = Color.Red
    Dim mySurroundColor As Color() = {Color.Blue}
    myPGBrush.SurroundColors = mySurroundColor

    ' Draw the brush to the screen prior to blend.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200)

    ' Set the Blend factors.
    myPGBrush.SetBlendTriangularShape(0.5F, 1.0F)

    ' Move the brush down by 100 by Applying the translate
    ' transform to the brush.
    myPGBrush.TranslateTransform(0, 100, MatrixOrder.Append)

    ' Draw the brush to the screen again after applying the
    ' transforms.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300)
End Sub

Açıklamalar

Dizide SurroundColors birden fazla renk varsa, dizideki ilk renk bitiş rengi için kullanılır. Bu dizide belirtilen renkler fırçanın sınır yolundaki ayrık noktalar için kullanılan renklerdir.

Varsayılan olarak, bir yol gradyanı sınırından orta noktaya ilerlerken, renk sınır renginden orta renge aşamalı olarak değişir. Bu yöntemi çağırarak sınır ve orta renklerin konumlandırma ve karıştırmasını özelleştirebilirsiniz.

Şunlara uygulanır