GraphicsPath.AddLine Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Anexa un segmento de línea a este trazado GraphicsPath.
Sobrecargas
AddLine(Int32, Int32, Int32, Int32) |
Agrega un segmento de línea a la figura actual. |
AddLine(Single, Single, Single, Single) |
Anexa un segmento de línea a este trazado GraphicsPath. |
AddLine(Point, Point) |
Anexa un segmento de línea a este trazado GraphicsPath. |
AddLine(PointF, PointF) |
Anexa un segmento de línea a este trazado GraphicsPath. |
AddLine(Int32, Int32, Int32, Int32)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
Agrega un segmento de línea a la figura actual.
public:
void AddLine(int x1, int y1, int x2, int y2);
public void AddLine (int x1, int y1, int x2, int y2);
member this.AddLine : int * int * int * int -> unit
Public Sub AddLine (x1 As Integer, y1 As Integer, x2 As Integer, y2 As Integer)
Parámetros
- x1
- Int32
Coordenada x del punto inicial de la línea.
- y1
- Int32
Coordenada y del punto inicial de la línea.
- x2
- Int32
Coordenada x del extremo de la línea.
- y2
- Int32
Coordenada y del extremo de la línea.
Ejemplos
El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse
, un OnPaint objeto de evento. El código crea una ruta de acceso, agrega tres líneas que forman un triángulo y, a continuación, dibuja la ruta de acceso a la pantalla.
private:
void AddLineExample( PaintEventArgs^ e )
{
//Create a path and add a symetrical triangle using AddLine.
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->AddLine( 30, 30, 60, 60 );
myPath->AddLine( 60, 60, 0, 60 );
myPath->AddLine( 0, 60, 30, 30 );
// Draw the path to the screen.
Pen^ myPen = gcnew Pen( Color::Black,2.0f );
e->Graphics->DrawPath( myPen, myPath );
}
private void AddLineExample(PaintEventArgs e)
{
//Create a path and add a symmetrical triangle using AddLine.
GraphicsPath myPath = new GraphicsPath();
myPath.AddLine(30, 30, 60, 60);
myPath.AddLine(60, 60, 0, 60);
myPath.AddLine(0, 60, 30, 30);
// Draw the path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddLineExample(ByVal e As PaintEventArgs)
' Create a path and add a symmetrical triangle using AddLine.
Dim myPath As New GraphicsPath
myPath.AddLine(30, 30, 60, 60)
myPath.AddLine(60, 60, 0, 60)
myPath.AddLine(0, 60, 30, 30)
' Draw the path to the screen.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub
Comentarios
Este método agrega el segmento de línea definido por los puntos especificados al final de la figura actual. Si hay líneas o curvas anteriores en GraphicsPath, se dibuja un segmento de línea para conectar el último punto de la ruta de acceso al primer punto del nuevo segmento de línea.
Se aplica a
AddLine(Single, Single, Single, Single)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
Anexa un segmento de línea a este trazado GraphicsPath.
public:
void AddLine(float x1, float y1, float x2, float y2);
public void AddLine (float x1, float y1, float x2, float y2);
member this.AddLine : single * single * single * single -> unit
Public Sub AddLine (x1 As Single, y1 As Single, x2 As Single, y2 As Single)
Parámetros
- x1
- Single
Coordenada x del punto inicial de la línea.
- y1
- Single
Coordenada y del punto inicial de la línea.
- x2
- Single
Coordenada x del extremo de la línea.
- y2
- Single
Coordenada y del extremo de la línea.
Ejemplos
Para obtener un ejemplo, consulte AddLine(Int32, Int32, Int32, Int32).
Comentarios
Este método agrega el segmento de línea definido por los puntos especificados al final de este GraphicsPath. Si hay líneas o curvas anteriores en GraphicsPath, se dibuja un segmento de línea para conectar el último punto de la ruta de acceso al primer punto del nuevo segmento de línea.
Se aplica a
AddLine(Point, Point)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
Anexa un segmento de línea a este trazado GraphicsPath.
public:
void AddLine(System::Drawing::Point pt1, System::Drawing::Point pt2);
public void AddLine (System.Drawing.Point pt1, System.Drawing.Point pt2);
member this.AddLine : System.Drawing.Point * System.Drawing.Point -> unit
Public Sub AddLine (pt1 As Point, pt2 As Point)
Parámetros
Ejemplos
Para obtener un ejemplo, consulte AddLine(Int32, Int32, Int32, Int32).
Comentarios
Este método agrega el segmento de línea definido por los puntos especificados al final de este GraphicsPath. Si hay líneas o curvas anteriores en GraphicsPath, se dibuja un segmento de línea para conectar el último punto de la ruta de acceso al primer punto del nuevo segmento de línea.
Se aplica a
AddLine(PointF, PointF)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
Anexa un segmento de línea a este trazado GraphicsPath.
public:
void AddLine(System::Drawing::PointF pt1, System::Drawing::PointF pt2);
public void AddLine (System.Drawing.PointF pt1, System.Drawing.PointF pt2);
member this.AddLine : System.Drawing.PointF * System.Drawing.PointF -> unit
Public Sub AddLine (pt1 As PointF, pt2 As PointF)
Parámetros
Ejemplos
Para obtener un ejemplo, consulte AddLine(Int32, Int32, Int32, Int32).
Comentarios
Este método agrega el segmento de línea definido por los puntos especificados al final de este GraphicsPath. Si hay líneas o curvas anteriores en GraphicsPath, se dibuja un segmento de línea para conectar el último punto de la ruta de acceso al primer punto del nuevo segmento de línea.
Se aplica a
Comentarios
https://aka.ms/ContentUserFeedback.
Próximamente: A lo largo de 2024 iremos eliminando gradualmente las Cuestiones de GitHub como mecanismo de retroalimentación para el contenido y lo sustituiremos por un nuevo sistema de retroalimentación. Para más información, consulta:Enviar y ver comentarios de