Graphics.DrawClosedCurve Método
Definição
Sobrecargas
| DrawClosedCurve(Pen, Point[], Single, FillMode) |
Desenha um spline cardinal fechado definido por uma matriz de estruturas Point usando uma tensão especificada.Draws a closed cardinal spline defined by an array of Point structures using a specified tension. |
| DrawClosedCurve(Pen, PointF[], Single, FillMode) |
Desenha um spline cardinal fechado definido por uma matriz de estruturas PointF usando uma tensão especificada.Draws a closed cardinal spline defined by an array of PointF structures using a specified tension. |
| DrawClosedCurve(Pen, Point[]) |
Desenha um spline cardinal fechado definido por uma matriz de estruturas Point.Draws a closed cardinal spline defined by an array of Point structures. |
| DrawClosedCurve(Pen, PointF[]) |
Desenha um spline cardinal fechado definido por uma matriz de estruturas PointF.Draws a closed cardinal spline defined by an array of PointF structures. |
DrawClosedCurve(Pen, Point[], Single, FillMode)
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)
Parâmetros
- pen
- Pen
Pen que determina a cor, largura e altura da curva.Pen that determines the color, width, and height of the curve.
- points
- Point[]
Matriz de estruturas Point que definem a spline.Array of Point structures that define the spline.
- tension
- Single
Valor maior ou igual a 0.0F que especifica a tensão da curva.Value greater than or equal to 0.0F that specifies the tension of the curve.
- fillmode
- FillMode
Membro da enumeração FillMode que determina como a curva é preenchida.Member of the FillMode enumeration that determines how the curve is filled. Este parâmetro é necessário, mas é ignorado.This parameter is required but ignored.
Exceções
Exemplos
O exemplo de código a seguir foi projetado para uso com Windows Forms, e ele requer PaintEventArgs e , que é um parâmetro do Paint manipulador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. O código executa as seguintes ações:The code performs the following actions:
Cria canetas vermelhas e verdes.Creates red and green pens.
Cria sete pontos para definir a curva.Creates seven points to define the curve.
Desenha sete linhas retas vermelhas entre os sete pontos para formar um polígono.Draws seven red straight lines between the seven points to form a polygon.
Cria configurações de modo de tensão e preenchimento.Creates tension and fill mode settings.
Desenha uma curva fechada verde nos sete pontos.Draws a green closed curve through the seven points.
O método usa uma tensão de 1,0 e define o modo de preenchimento como FillMode.Alternate .The method uses a tension of 1.0 and sets the fill mode to 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
Comentários
Esse método desenha um spline Cardinal fechado que passa por cada ponto na matriz.This method draws a closed cardinal spline that passes through each point in the array. Se o último ponto não corresponder ao primeiro ponto, um segmento de curva adicional será adicionado do último ponto ao primeiro ponto para fechá-lo.If the last point does not match the first point, an additional curve segment is added from the last point to the first point to close it.
A matriz de pontos deve conter pelo menos quatro Point estruturas.The array of points must contain at least four Point structures.
O tension parâmetro determina a forma do spline.The tension parameter determines the shape of the spline. Se o valor do tension parâmetro for 0,0 f, esse método desenhará segmentos de linha reta para conectar os pontos.If the value of the tension parameter is 0.0F, this method draws straight line segments to connect the points. Normalmente, o tension parâmetro é menor ou igual a 1,0 f.Usually, the tension parameter is less than or equal to 1.0F. Os valores acima de 1,0 F geram resultados incomuns.Values over 1.0F produce unusual results.
Aplica-se a
DrawClosedCurve(Pen, PointF[], Single, FillMode)
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)
Parâmetros
- pen
- Pen
Pen que determina a cor, largura e altura da curva.Pen that determines the color, width, and height of the curve.
- points
- PointF[]
Matriz de estruturas PointF que definem a spline.Array of PointF structures that define the spline.
- tension
- Single
Valor maior ou igual a 0.0F que especifica a tensão da curva.Value greater than or equal to 0.0F that specifies the tension of the curve.
- fillmode
- FillMode
Membro da enumeração FillMode que determina como a curva é preenchida.Member of the FillMode enumeration that determines how the curve is filled. Este parâmetro é necessário, mas é ignorado.This parameter is required but is ignored.
Exceções
Exemplos
O exemplo de código a seguir foi projetado para uso com Windows Forms, e ele requer PaintEventArgs e , que é um parâmetro do Paint manipulador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. O código executa as seguintes ações:The code performs the following actions:
Cria canetas vermelhas e verdes.Creates red and green pens.
Cria sete pontos para definir a curva.Creates seven points to define the curve.
Desenha sete linhas retas vermelhas entre os sete pontos para formar um polígono.Draws seven red straight lines between the seven points to form a polygon.
Cria configurações de modo de tensão e preenchimento.Creates tension and fill mode settings.
Desenha uma curva fechada verde nos sete pontos.Draws a green closed curve through the seven points.
O método usa uma tensão de 1,0 e define o modo de preenchimento como FillMode.Alternate .The method uses a tension of 1.0 and sets the fill mode to 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
Comentários
Esse método desenha um spline Cardinal fechado que passa por cada ponto na matriz.This method draws a closed cardinal spline that passes through each point in the array. Se o último ponto não corresponder ao primeiro ponto, um segmento de curva adicional será adicionado do último ponto ao primeiro ponto para fechá-lo.If the last point does not match the first point, an additional curve segment is added from the last point to the first point to close it.
A matriz de pontos deve conter pelo menos quatro PointF estruturas.The array of points must contain at least four PointF structures.
O tension parâmetro determina a forma do spline.The tension parameter determines the shape of the spline. Se o valor do tension parâmetro for 0,0 f, esse método desenhará segmentos de linha reta para conectar os pontos.If the value of the tension parameter is 0.0F, this method draws straight line segments to connect the points. Normalmente, o tension parâmetro é menor ou igual a 1,0 f.Usually, the tension parameter is less than or equal to 1.0F. Os valores acima de 1,0 F geram resultados incomuns.Values over 1.0F produce unusual results.
Aplica-se a
DrawClosedCurve(Pen, Point[])
public:
void DrawClosedCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::Point> ^ points);
public void DrawClosedCurve (System.Drawing.Pen pen, System.Drawing.Point[] points);
member this.DrawClosedCurve : System.Drawing.Pen * System.Drawing.Point[] -> unit
Public Sub DrawClosedCurve (pen As Pen, points As Point())
Parâmetros
- pen
- Pen
Pen que determina a cor, largura e altura da curva.Pen that determines the color, width, and height of the curve.
- points
- Point[]
Matriz de estruturas Point que definem a spline.Array of Point structures that define the spline.
Exceções
Exemplos
O exemplo de código a seguir foi projetado para uso com Windows Forms, e ele requer PaintEventArgs e , que é um parâmetro do Paint manipulador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. O código executa as seguintes ações:The code performs the following actions:
Cria canetas vermelhas e verdes.Creates red and green pens.
Cria sete pontos para definir uma curva.Creates seven points to define a curve.
Desenha sete linhas retas vermelhas entre os sete pontos para formar um polígono fechado.Draws seven red straight lines between the seven points to form a closed polygon.
Desenha uma curva fechada verde nos sete pontos.Draws a green closed curve through the seven points.
O método usa uma tensão padrão de 0,5.The method uses a default tension of 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
Comentários
Esse método desenha um spline Cardinal fechado que passa por cada ponto na matriz.This method draws a closed cardinal spline that passes through each point in the array. Se o último ponto não corresponder ao primeiro ponto, um segmento de curva adicional será adicionado do último ponto ao primeiro ponto para fechar a figura.If the last point does not match the first point, an additional curve segment is added from the last point to the first point to close the figure.
A matriz de pontos deve conter pelo menos quatro Point estruturas.The array of points must contain at least four Point structures.
Esse método usa uma tensão padrão de 0,5.This method uses a default tension of 0.5.
Aplica-se a
DrawClosedCurve(Pen, PointF[])
public:
void DrawClosedCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points);
public void DrawClosedCurve (System.Drawing.Pen pen, System.Drawing.PointF[] points);
member this.DrawClosedCurve : System.Drawing.Pen * System.Drawing.PointF[] -> unit
Public Sub DrawClosedCurve (pen As Pen, points As PointF())
Parâmetros
- pen
- Pen
Pen que determina a cor, largura e altura da curva.Pen that determines the color, width, and height of the curve.
- points
- PointF[]
Matriz de estruturas PointF que definem a spline.Array of PointF structures that define the spline.
Exceções
Exemplos
O exemplo de código a seguir foi projetado para uso com Windows Forms, e ele requer PaintEventArgs e , que é um parâmetro do Paint manipulador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. O código executa as seguintes ações:The code performs the following actions:
Cria canetas vermelhas e verdes.Creates red and green pens.
Cria sete pontos para definir uma curva.Creates seven points to define a curve.
Desenha sete linhas retas vermelhas entre os sete pontos para formar um polígono fechado.Draws seven red straight lines between the seven points to form a closed polygon.
Desenha uma curva fechada verde nos sete pontos.Draws a green closed curve through the seven points.
O método usa uma tensão padrão de 0,5.The method uses a default tension of 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
Comentários
Esse método desenha um spline Cardinal fechado que passa por cada ponto na matriz.This method draws a closed cardinal spline that passes through each point in the array. Se o último ponto não corresponder ao primeiro ponto, um segmento de curva adicional será adicionado do último ponto ao primeiro ponto para fechá-lo.If the last point does not match the first point, an additional curve segment is added from the last point to the first point to close it.
A matriz de pontos deve conter pelo menos quatro PointF estruturas.The array of points must contain at least four PointF structures.
Esse método usa uma tensão padrão de 0,5.This method uses a default tension of 0.5.