GraphicsPath.AddPath(GraphicsPath, Boolean) 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 el trazado GraphicsPath especificado a este trazado.
public:
void AddPath(System::Drawing::Drawing2D::GraphicsPath ^ addingPath, bool connect);
public void AddPath (System.Drawing.Drawing2D.GraphicsPath addingPath, bool connect);
member this.AddPath : System.Drawing.Drawing2D.GraphicsPath * bool -> unit
Public Sub AddPath (addingPath As GraphicsPath, connect As Boolean)
Parámetros
- addingPath
- GraphicsPath
GraphicsPath que se va a agregar.
- connect
- Boolean
Valor booleano que especifica si la primera figura del trazado agregado forma parte de la última figura de este trazado. El valor true
especifica que, si es posible, la primera figura del trazado agregado forma parte de la última figura de este trazado. El valor false
especifica que la primera figura del trazado agregado no forma parte de la última figura de este trazado.
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 realiza las siguientes acciones:
Crea dos rutas de acceso uno de un triángulo derecho y el otro un triángulo lateral hacia abajo.
Agrega la segunda ruta de acceso a la primera.
Dibuja la ruta de acceso resultante a la pantalla.
private:
void AddPathExample( PaintEventArgs^ e )
{
// Create the first pathright side up triangle.
array<Point>^ myArray = {Point(30,30),Point(60,60),Point(0,60),Point(30,30)};
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->AddLines( myArray );
// Create the second pathinverted triangle.
array<Point>^ myArray2 = {Point(30,30),Point(0,0),Point(60,0),Point(30,30)};
GraphicsPath^ myPath2 = gcnew GraphicsPath;
myPath2->AddLines( myArray2 );
// Add the second path to the first path.
myPath->AddPath( myPath2, true );
// Draw the combined path to the screen.
Pen^ myPen = gcnew Pen( Color::Black,2.0f );
e->Graphics->DrawPath( myPen, myPath );
}
private void AddPathExample(PaintEventArgs e)
{
// Create the first pathright side up triangle.
Point[] myArray =
{
new Point(30,30),
new Point(60,60),
new Point(0,60),
new Point(30,30)
};
GraphicsPath myPath = new GraphicsPath();
myPath.AddLines(myArray);
// Create the second pathinverted triangle.
Point[] myArray2 =
{
new Point(30,30),
new Point(0,0),
new Point(60,0),
new Point(30,30)
};
GraphicsPath myPath2 = new GraphicsPath();
myPath2.AddLines(myArray2);
// Add the second path to the first path.
myPath.AddPath(myPath2,true);
// Draw the combined path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddPathExample(ByVal e As PaintEventArgs)
' Creates a symmetrical triangle and adds an inverted triangle.
' Create the first path - right side up triangle.
Dim myArray As Point() = {New Point(30, 30), New Point(60, 60), _
New Point(0, 60), New Point(30, 30)}
Dim myPath As New GraphicsPath
myPath.AddLines(myArray)
' Create the second path - inverted triangle.
Dim myArray2 As Point() = {New Point(30, 30), New Point(0, 0), _
New Point(60, 0), New Point(30, 30)}
Dim myPath2 As New GraphicsPath
myPath2.AddLines(myArray2)
' Add the second path to the first path.
myPath.AddPath(myPath2, True)
' Draw the combined path to the screen.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub
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