Partage via


PathGradientBrush.SetSigmaBellShape Méthode

Définition

Crée une chute dégradée entre la couleur centrale et la première couleur environnante en fonction d’une courbe en forme de cloche.

Surcharges

SetSigmaBellShape(Single)

Crée un pinceau dégradé qui change de couleur à partir du centre du chemin vers l’extérieur vers la limite du chemin. La transition d’une couleur à une autre est basée sur une courbe en forme de cloche.

SetSigmaBellShape(Single, Single)

Crée un pinceau dégradé qui change de couleur à partir du centre du chemin vers l’extérieur vers la limite du chemin. La transition d’une couleur à une autre est basée sur une courbe en forme de cloche.

SetSigmaBellShape(Single)

Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs

Crée un pinceau dégradé qui change de couleur à partir du centre du chemin vers l’extérieur vers la limite du chemin. La transition d’une couleur à une autre est basée sur une courbe en forme de cloche.

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

Paramètres

focus
Single

Valeur comprise entre 0 et 1 qui spécifie où, le long de n’importe quel radial du centre du chemin vers la limite du chemin, la couleur centrale est à son intensité la plus élevée. La valeur 1 (valeur par défaut) place l’intensité la plus élevée au centre du chemin.

Exemples

Pour obtenir un exemple, consultez SetSigmaBellShape.

Remarques

S’il existe plusieurs couleurs dans le tableau SurroundColors, la première couleur du tableau est utilisée pour la couleur de fin. Les couleurs spécifiées dans ce tableau sont des couleurs utilisées pour les points discrets sur le chemin de limite du pinceau.

Par défaut, lorsque vous passez de la limite d’un dégradé de chemin vers le point central, la couleur passe progressivement de la couleur de limite à la couleur centrale. Vous pouvez personnaliser le positionnement et le mélange des couleurs de limite et de centre en appelant cette méthode.

S’applique à

SetSigmaBellShape(Single, Single)

Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs

Crée un pinceau dégradé qui change de couleur à partir du centre du chemin vers l’extérieur vers la limite du chemin. La transition d’une couleur à une autre est basée sur une courbe en forme de cloche.

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

Paramètres

focus
Single

Valeur comprise entre 0 et 1 qui spécifie où, le long de n’importe quel radial du centre du chemin vers la limite du chemin, la couleur centrale est à son intensité la plus élevée. La valeur 1 (valeur par défaut) place l’intensité la plus élevée au centre du chemin.

scale
Single

Valeur comprise entre 0 et 1 qui spécifie l’intensité maximale de la couleur centrale qui est fusionnée avec la couleur de limite. La valeur 1 entraîne la plus forte intensité possible de la couleur centrale, et il s’agit de la valeur par défaut.

Exemples

L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse, un objet d’événement OnPaint. Le code effectue les actions suivantes :

  • Crée un chemin d’accès graphique et ajoute un rectangle à celui-ci.

  • Crée un PathGradientBrush à partir des points de chemin d’accès (dans cet exemple, les points forment un rectangle, mais il peut s’agir de la plupart des formes).

  • Définit la couleur centrale sur rouge et la couleur environnante sur bleu.

  • Dessine le PathGradientBrush à l’écran avant d’appliquer la transformation de fusion.

  • Applique la transformation de fusion au pinceau à l’aide de sa méthode de SetSigmaBellShape.

  • Appelle la méthode TranslateTransform pour déplacer le rectangle de pinceau de sorte qu’il ne superpose pas celui dessiné à l’écran précédemment.

  • Dessine le rectangle de pinceau transformé à l’écran.

Notez que la couleur centrale maximale (rouge) est située à mi-chemin du centre du chemin d’accès à la limite du chemin.

public:
   void SetSigmaBellShapeExample( 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 blend.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );

      // Set the Blend factors and transform the brush.
      myPGBrush->SetSigmaBellShape( 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 setting the
      // blend and applying the transform.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 );
   }
public void SetSigmaBellShapeExample(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 blend.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);
             
    // Set the Blend factors and transform the brush.
    myPGBrush.SetSigmaBellShape(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 setting the
    // blend and applying the transform.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300);
}
Public Sub SetSigmaBellShapeExample(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.SetSigmaBellShape(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 setting the
    ' blend and applying the transform.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300)
End Sub

Remarques

S’il existe plusieurs couleurs dans le tableau SurroundColors, la première couleur du tableau est utilisée pour la couleur de fin. Les couleurs spécifiées dans ce tableau sont des couleurs utilisées pour les points discrets sur le chemin de limite du pinceau.

Par défaut, lorsque vous passez de la limite d’un dégradé de chemin vers le point central, la couleur passe progressivement de la couleur de limite à la couleur centrale. Vous pouvez personnaliser le positionnement et le mélange des couleurs de limite et de centre en appelant cette méthode.

S’applique à