Graphics.DrawClosedCurve Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Dessine une spline cardinale fermée définie par un tableau de structures Point.
Surcharges
DrawClosedCurve(Pen, ReadOnlySpan<Point>, Single, FillMode) | |
DrawClosedCurve(Pen, PointF[], Single, FillMode) |
Dessine une spline cardinale fermée définie par un tableau de structures PointF à l’aide d’une tension spécifiée. |
DrawClosedCurve(Pen, Point[], Single, FillMode) |
Dessine une spline cardinale fermée définie par un tableau de structures Point à l’aide d’une tension spécifiée. |
DrawClosedCurve(Pen, ReadOnlySpan<PointF>, Single, FillMode) | |
DrawClosedCurve(Pen, ReadOnlySpan<Point>) | |
DrawClosedCurve(Pen, Point[]) |
Dessine une spline cardinale fermée définie par un tableau de structures Point. |
DrawClosedCurve(Pen, ReadOnlySpan<PointF>) | |
DrawClosedCurve(Pen, PointF[]) |
Dessine une spline cardinale fermée définie par un tableau de structures PointF. |
DrawClosedCurve(Pen, ReadOnlySpan<Point>, Single, FillMode)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
public:
void DrawClosedCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Point> points, float tension, System::Drawing::Drawing2D::FillMode fillmode);
public void DrawClosedCurve (System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.Point> points, float tension, System.Drawing.Drawing2D.FillMode fillmode);
member this.DrawClosedCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.Point> * single * System.Drawing.Drawing2D.FillMode -> unit
Public Sub DrawClosedCurve (pen As Pen, points As ReadOnlySpan(Of Point), tension As Single, fillmode As FillMode)
Paramètres
- pen
- Pen
- points
- ReadOnlySpan<Point>
- tension
- Single
- fillmode
- FillMode
S’applique à
DrawClosedCurve(Pen, PointF[], Single, FillMode)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
Dessine une spline cardinale fermée définie par un tableau de structures PointF à l’aide d’une tension spécifiée.
public:
void DrawClosedCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points, float tension, System::Drawing::Drawing2D::FillMode fillmode);
public void DrawClosedCurve (System.Drawing.Pen pen, System.Drawing.PointF[] points, float tension, System.Drawing.Drawing2D.FillMode fillmode);
member this.DrawClosedCurve : System.Drawing.Pen * System.Drawing.PointF[] * single * System.Drawing.Drawing2D.FillMode -> unit
Public Sub DrawClosedCurve (pen As Pen, points As PointF(), tension As Single, fillmode As FillMode)
Paramètres
- tension
- Single
Valeur supérieure ou égale à 0,0F qui spécifie la tension de la courbe.
- fillmode
- FillMode
Membre de l’énumération FillMode qui détermine la façon dont la courbe est remplie. Ce paramètre est obligatoire, mais il est ignoré.
Exceptions
Exemples
L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse
, qui est un paramètre du gestionnaire d’événements Paint. Le code effectue les actions suivantes :
Crée des stylos rouges et verts.
Crée sept points pour définir la courbe.
Dessine sept lignes droites rouges entre les sept points pour former un polygone.
Crée des paramètres de tension et de mode de remplissage.
Dessine une courbe fermée verte à travers les sept points.
La méthode utilise une tension de 1,0 et définit le mode de remplissage sur FillMode.Alternate
.
private:
void DrawClosedCurvePointFTension( PaintEventArgs^ e )
{
// Create pens.
Pen^ redPen = gcnew Pen( Color::Red,3.0f );
Pen^ greenPen = gcnew Pen( Color::Green,3.0f );
// Create points that define curve.
PointF point1 = PointF(50.0F,50.0F);
PointF point2 = PointF(100.0F,25.0F);
PointF point3 = PointF(200.0F,5.0F);
PointF point4 = PointF(250.0F,50.0F);
PointF point5 = PointF(300.0F,100.0F);
PointF point6 = PointF(350.0F,200.0F);
PointF point7 = PointF(250.0F,250.0F);
array<PointF>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};
// Draw lines between original points to screen.
e->Graphics->DrawLines( redPen, curvePoints );
// Create tension and fill mode.
float tension = 1.0F;
FillMode aFillMode = FillMode::Alternate;
// Draw closed curve to screen.
e->Graphics->DrawClosedCurve( greenPen, curvePoints, tension, aFillMode );
}
private void DrawClosedCurvePointFTension(PaintEventArgs e)
{
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
// Create points that define curve.
PointF point1 = new PointF(50.0F, 50.0F);
PointF point2 = new PointF(100.0F, 25.0F);
PointF point3 = new PointF(200.0F, 5.0F);
PointF point4 = new PointF(250.0F, 50.0F);
PointF point5 = new PointF(300.0F, 100.0F);
PointF point6 = new PointF(350.0F, 200.0F);
PointF point7 = new PointF(250.0F, 250.0F);
PointF[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};
// Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints);
// Create tension and fill mode.
float tension = 1.0F;
FillMode aFillMode = FillMode.Alternate;
// Draw closed curve to screen.
e.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, aFillMode);
}
Private Sub DrawClosedCurvePointFTension(ByVal e As PaintEventArgs)
' Create pens.
Dim redPen As New Pen(Color.Red, 3)
Dim greenPen As New Pen(Color.Green, 3)
' Create points that define curve.
Dim point1 As New PointF(50.0F, 50.0F)
Dim point2 As New PointF(100.0F, 25.0F)
Dim point3 As New PointF(200.0F, 5.0F)
Dim point4 As New PointF(250.0F, 50.0F)
Dim point5 As New PointF(300.0F, 100.0F)
Dim point6 As New PointF(350.0F, 200.0F)
Dim point7 As New PointF(250.0F, 250.0F)
Dim curvePoints As PointF() = {point1, point2, point3, point4, _
point5, point6, point7}
' Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints)
' Create tension and fill mode.
Dim tension As Single = 1.0F
Dim aFillMode As FillMode = FillMode.Alternate
' Draw closed curve to screen.
e.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, _
aFillMode)
End Sub
Remarques
Cette méthode dessine une spline cardinale fermée qui passe à chaque point du tableau. Si le dernier point ne correspond pas au premier point, un segment de courbe supplémentaire est ajouté du dernier point au premier point pour le fermer.
Le tableau de points doit contenir au moins quatre structures PointF.
Le paramètre tension
détermine la forme du spline. Si la valeur du paramètre tension
est 0,0F, cette méthode dessine des segments de ligne droite pour connecter les points. En règle générale, le paramètre tension
est inférieur ou égal à 1,0F. Les valeurs supérieures à 1,0F produisent des résultats inhabituels.
S’applique à
DrawClosedCurve(Pen, Point[], Single, FillMode)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
Dessine une spline cardinale fermée définie par un tableau de structures Point à l’aide d’une tension spécifiée.
public:
void DrawClosedCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::Point> ^ points, float tension, System::Drawing::Drawing2D::FillMode fillmode);
public void DrawClosedCurve (System.Drawing.Pen pen, System.Drawing.Point[] points, float tension, System.Drawing.Drawing2D.FillMode fillmode);
member this.DrawClosedCurve : System.Drawing.Pen * System.Drawing.Point[] * single * System.Drawing.Drawing2D.FillMode -> unit
Public Sub DrawClosedCurve (pen As Pen, points As Point(), tension As Single, fillmode As FillMode)
Paramètres
- tension
- Single
Valeur supérieure ou égale à 0,0F qui spécifie la tension de la courbe.
- fillmode
- FillMode
Membre de l’énumération FillMode qui détermine la façon dont la courbe est remplie. Ce paramètre est obligatoire, mais ignoré.
Exceptions
Exemples
L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse
, qui est un paramètre du gestionnaire d’événements Paint. Le code effectue les actions suivantes :
Crée des stylos rouges et verts.
Crée sept points pour définir la courbe.
Dessine sept lignes droites rouges entre les sept points pour former un polygone.
Crée des paramètres de tension et de mode de remplissage.
Dessine une courbe fermée verte à travers les sept points.
La méthode utilise une tension de 1,0 et définit le mode de remplissage sur FillMode.Alternate
.
private:
void DrawClosedCurvePointTension( PaintEventArgs^ e )
{
// Create pens.
Pen^ redPen = gcnew Pen( Color::Red,3.0f );
Pen^ greenPen = gcnew Pen( Color::Green,3.0f );
// Create points that define curve.
Point point1 = Point(50,50);
Point point2 = Point(100,25);
Point point3 = Point(200,5);
Point point4 = Point(250,50);
Point point5 = Point(300,100);
Point point6 = Point(350,200);
Point point7 = Point(250,250);
array<Point>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};
// Draw lines between original points to screen.
e->Graphics->DrawLines( redPen, curvePoints );
// Create tension and fill mode.
float tension = 1.0F;
FillMode aFillMode = FillMode::Alternate;
// Draw closed curve to screen.
e->Graphics->DrawClosedCurve( greenPen, curvePoints, tension, aFillMode );
}
private void DrawClosedCurvePointTension(PaintEventArgs e)
{
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
// Create points that define curve.
Point point1 = new Point(50, 50);
Point point2 = new Point(100, 25);
Point point3 = new Point(200, 5);
Point point4 = new Point(250, 50);
Point point5 = new Point(300, 100);
Point point6 = new Point(350, 200);
Point point7 = new Point(250, 250);
Point[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};
// Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints);
// Create tension and fill mode.
float tension = 1.0F;
FillMode aFillMode = FillMode.Alternate;
// Draw closed curve to screen.
e.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, aFillMode);
}
Private Sub DrawClosedCurvePointTension(ByVal e As PaintEventArgs)
' Create pens.
Dim redPen As New Pen(Color.Red, 3)
Dim greenPen As New Pen(Color.Green, 3)
' Create points that define curve.
Dim point1 As New Point(50, 50)
Dim point2 As New Point(100, 25)
Dim point3 As New Point(200, 5)
Dim point4 As New Point(250, 50)
Dim point5 As New Point(300, 100)
Dim point6 As New Point(350, 200)
Dim point7 As New Point(250, 250)
Dim curvePoints As Point() = {point1, point2, point3, point4, _
point5, point6, point7}
' Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints)
' Create tension and fill mode.
Dim tension As Single = 1.0F
Dim aFillMode As FillMode = FillMode.Alternate
' Draw closed curve to screen.
e.Graphics.DrawClosedCurve(greenPen, curvePoints, tension, _
aFillMode)
End Sub
Remarques
Cette méthode dessine une spline cardinale fermée qui passe à chaque point du tableau. Si le dernier point ne correspond pas au premier point, un segment de courbe supplémentaire est ajouté du dernier point au premier point pour le fermer.
Le tableau de points doit contenir au moins quatre structures Point.
Le paramètre tension
détermine la forme du spline. Si la valeur du paramètre tension
est 0,0F, cette méthode dessine des segments de ligne droite pour connecter les points. En règle générale, le paramètre tension
est inférieur ou égal à 1,0F. Les valeurs supérieures à 1,0F produisent des résultats inhabituels.
S’applique à
DrawClosedCurve(Pen, ReadOnlySpan<PointF>, Single, FillMode)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
public:
void DrawClosedCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points, float tension, System::Drawing::Drawing2D::FillMode fillmode);
public void DrawClosedCurve (System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.PointF> points, float tension, System.Drawing.Drawing2D.FillMode fillmode);
member this.DrawClosedCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> * single * System.Drawing.Drawing2D.FillMode -> unit
Public Sub DrawClosedCurve (pen As Pen, points As ReadOnlySpan(Of PointF), tension As Single, fillmode As FillMode)
Paramètres
- pen
- Pen
- points
- ReadOnlySpan<PointF>
- tension
- Single
- fillmode
- FillMode
S’applique à
DrawClosedCurve(Pen, ReadOnlySpan<Point>)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
public:
void DrawClosedCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Point> points);
public void DrawClosedCurve (System.Drawing.Pen pen, scoped ReadOnlySpan<System.Drawing.Point> points);
member this.DrawClosedCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.Point> -> unit
Public Sub DrawClosedCurve (pen As Pen, points As ReadOnlySpan(Of Point))
Paramètres
- pen
- Pen
- points
- ReadOnlySpan<Point>
S’applique à
DrawClosedCurve(Pen, Point[])
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
Dessine une spline cardinale fermée définie par un tableau de structures Point.
public:
void DrawClosedCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::Point> ^ points);
public:
void DrawClosedCurve(System::Drawing::Pen ^ pen, ... cli::array <System::Drawing::Point> ^ points);
public void DrawClosedCurve (System.Drawing.Pen pen, System.Drawing.Point[] points);
public void DrawClosedCurve (System.Drawing.Pen pen, params System.Drawing.Point[] points);
member this.DrawClosedCurve : System.Drawing.Pen * System.Drawing.Point[] -> unit
Public Sub DrawClosedCurve (pen As Pen, points As Point())
Public Sub DrawClosedCurve (pen As Pen, ParamArray points As Point())
Paramètres
Exceptions
Exemples
L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse
, qui est un paramètre du gestionnaire d’événements Paint. Le code effectue les actions suivantes :
Crée des stylos rouges et verts.
Crée sept points pour définir une courbe.
Dessine sept lignes droites rouges entre les sept points pour former un polygone fermé.
Dessine une courbe fermée verte à travers les sept points.
La méthode utilise une tension par défaut de 0,5.
private:
void DrawClosedCurvePoint( PaintEventArgs^ e )
{
// Create pens.
Pen^ redPen = gcnew Pen( Color::Red,3.0f );
Pen^ greenPen = gcnew Pen( Color::Green,3.0f );
// Create points that define curve.
Point point1 = Point(50,50);
Point point2 = Point(100,25);
Point point3 = Point(200,5);
Point point4 = Point(250,50);
Point point5 = Point(300,100);
Point point6 = Point(350,200);
Point point7 = Point(250,250);
array<Point>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};
// Draw lines between original points to screen.
e->Graphics->DrawLines( redPen, curvePoints );
// Draw closed curve to screen.
e->Graphics->DrawClosedCurve( greenPen, curvePoints );
}
private void DrawClosedCurvePoint(PaintEventArgs e)
{
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
// Create points that define curve.
Point point1 = new Point(50, 50);
Point point2 = new Point(100, 25);
Point point3 = new Point(200, 5);
Point point4 = new Point(250, 50);
Point point5 = new Point(300, 100);
Point point6 = new Point(350, 200);
Point point7 = new Point(250, 250);
Point[] curvePoints =
{
point1,
point2,
point3,
point4,
point5,
point6,
point7
};
// Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints);
// Draw closed curve to screen.
e.Graphics.DrawClosedCurve(greenPen, curvePoints);
}
Private Sub DrawClosedCurvePoint(ByVal e As PaintEventArgs)
' Create pens.
Dim redPen As New Pen(Color.Red, 3)
Dim greenPen As New Pen(Color.Green, 3)
' Create points that define curve.
Dim point1 As New Point(50, 50)
Dim point2 As New Point(100, 25)
Dim point3 As New Point(200, 5)
Dim point4 As New Point(250, 50)
Dim point5 As New Point(300, 100)
Dim point6 As New Point(350, 200)
Dim point7 As New Point(250, 250)
Dim curvePoints As Point() = {point1, point2, point3, point4, _
point5, point6, point7}
' Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints)
' Draw closed curve to screen.
e.Graphics.DrawClosedCurve(greenPen, curvePoints)
End Sub
Remarques
Cette méthode dessine une spline cardinale fermée qui passe à chaque point du tableau. Si le dernier point ne correspond pas au premier point, un segment de courbe supplémentaire est ajouté du dernier point au premier point pour fermer la figure.
Le tableau de points doit contenir au moins quatre structures Point.
Cette méthode utilise une tension par défaut de 0,5.
S’applique à
DrawClosedCurve(Pen, ReadOnlySpan<PointF>)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
public:
void DrawClosedCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points);
public void DrawClosedCurve (System.Drawing.Pen pen, scoped ReadOnlySpan<System.Drawing.PointF> points);
member this.DrawClosedCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub DrawClosedCurve (pen As Pen, points As ReadOnlySpan(Of PointF))
Paramètres
- pen
- Pen
- points
- ReadOnlySpan<PointF>
S’applique à
DrawClosedCurve(Pen, PointF[])
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
Dessine une spline cardinale fermée définie par un tableau de structures PointF.
public:
void DrawClosedCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points);
public:
void DrawClosedCurve(System::Drawing::Pen ^ pen, ... cli::array <System::Drawing::PointF> ^ points);
public void DrawClosedCurve (System.Drawing.Pen pen, System.Drawing.PointF[] points);
public void DrawClosedCurve (System.Drawing.Pen pen, params System.Drawing.PointF[] points);
member this.DrawClosedCurve : System.Drawing.Pen * System.Drawing.PointF[] -> unit
Public Sub DrawClosedCurve (pen As Pen, points As PointF())
Public Sub DrawClosedCurve (pen As Pen, ParamArray points As PointF())
Paramètres
Exceptions
Exemples
L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse
, qui est un paramètre du gestionnaire d’événements Paint. Le code effectue les actions suivantes :
Crée des stylos rouges et verts.
Crée sept points pour définir une courbe.
Dessine sept lignes droites rouges entre les sept points pour former un polygone fermé.
Dessine une courbe fermée verte à travers les sept points.
La méthode utilise une tension par défaut de 0,5.
private:
void DrawClosedCurvePointF( PaintEventArgs^ e )
{
// Create pens.
Pen^ redPen = gcnew Pen( Color::Red,3.0f );
Pen^ greenPen = gcnew Pen( Color::Green,3.0f );
// Create points that define curve.
PointF point1 = PointF(50.0F,50.0F);
PointF point2 = PointF(100.0F,25.0F);
PointF point3 = PointF(200.0F,5.0F);
PointF point4 = PointF(250.0F,50.0F);
PointF point5 = PointF(300.0F,100.0F);
PointF point6 = PointF(350.0F,200.0F);
PointF point7 = PointF(250.0F,250.0F);
array<PointF>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};
// Draw lines between original points to screen.
e->Graphics->DrawLines( redPen, curvePoints );
// Draw closed curve to screen.
e->Graphics->DrawClosedCurve( greenPen, curvePoints );
}
private void DrawClosedCurvePointF(PaintEventArgs e)
{
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
// Create points that define curve.
PointF point1 = new PointF(50.0F, 50.0F);
PointF point2 = new PointF(100.0F, 25.0F);
PointF point3 = new PointF(200.0F, 5.0F);
PointF point4 = new PointF(250.0F, 50.0F);
PointF point5 = new PointF(300.0F, 100.0F);
PointF point6 = new PointF(350.0F, 200.0F);
PointF point7 = new PointF(250.0F, 250.0F);
PointF[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};
// Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints);
// Draw closed curve to screen.
e.Graphics.DrawClosedCurve(greenPen, curvePoints);
}
Private Sub DrawClosedCurvePointF(ByVal e As PaintEventArgs)
' Create pens.
Dim redPen As New Pen(Color.Red, 3)
Dim greenPen As New Pen(Color.Green, 3)
' Create points that define curve.
Dim point1 As New PointF(50.0F, 50.0F)
Dim point2 As New PointF(100.0F, 25.0F)
Dim point3 As New PointF(200.0F, 5.0F)
Dim point4 As New PointF(250.0F, 50.0F)
Dim point5 As New PointF(300.0F, 100.0F)
Dim point6 As New PointF(350.0F, 200.0F)
Dim point7 As New PointF(250.0F, 250.0F)
Dim curvePoints As PointF() = {point1, point2, point3, point4, _
point5, point6, point7}
' Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints)
' Draw closed curve to screen.
e.Graphics.DrawClosedCurve(greenPen, curvePoints)
End Sub
Remarques
Cette méthode dessine une spline cardinale fermée qui passe à chaque point du tableau. Si le dernier point ne correspond pas au premier point, un segment de courbe supplémentaire est ajouté du dernier point au premier point pour le fermer.
Le tableau de points doit contenir au moins quatre structures PointF.
Cette méthode utilise une tension par défaut de 0,5.