Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Erstellt eine genaue Kopie von diesem Pfad.
Namespace: System.Drawing.Drawing2D
Assembly: System.Drawing (in system.drawing.dll)
Syntax
'Declaration
Public Function Clone As Object
'Usage
Dim instance As GraphicsPath
Dim returnValue As Object
returnValue = instance.Clone
public Object Clone ()
public:
virtual Object^ Clone () sealed
public final Object Clone ()
public final function Clone () : Object
Rückgabewert
Der von dieser Methode erstellte GraphicsPath, umgewandelt in ein Objekt.
Beispiel
Das folgende Codebeispiel ist für die Verwendung mit Windows Forms vorgesehen und erfordert das OnPaint-Ereignisobjekt PaintEventArgse. Der Code führt die folgenden Aktionen aus:
Erstellt einen Pfad.
Fügt dem Pfad mehrere Figuren hinzu.
Zeichnet den Pfad auf dem Bildschirm.
Erstellt einen Klon dieses Pfads.
Zeichnet den Pfad auf dem Bildschirm.
Beachten Sie, dass der Aufruf der Clone-Methode in ein GraphicsPath umgewandelt werden muss.
Public Sub CloneExample(ByVal e As PaintEventArgs)
' Set several markers in a path.
Dim myPath As New GraphicsPath
myPath.AddEllipse(0, 0, 100, 200)
myPath.AddLine(New Point(100, 100), New Point(200, 100))
Dim rect As New Rectangle(200, 0, 100, 200)
myPath.AddRectangle(rect)
myPath.AddLine(New Point(250, 200), New Point(250, 300))
' Draw the path to the screen.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
' Clone a copy of myPath.
Dim myPath2 As GraphicsPath = CType(myPath.Clone(), GraphicsPath)
' Draw the path to the screen.
Dim myPen2 As New Pen(Color.Red, 4)
e.Graphics.DrawPath(myPen2, myPath2)
End Sub
private void CloneExample(PaintEventArgs e)
{
// Set several markers in a path.
GraphicsPath myPath = new GraphicsPath();
myPath.AddEllipse(0, 0, 100, 200);
myPath.AddLine(new Point(100, 100), new Point(200, 100));
Rectangle rect = new Rectangle(200, 0, 100, 200);
myPath.AddRectangle(rect);
myPath.AddLine(new Point(250, 200), new Point(250, 300));
// Draw the path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
// Clone a copy of myPath.
GraphicsPath myPath2 = (GraphicsPath)myPath.Clone();
// Draw the path to the screen.
Pen myPen2 = new Pen(Color.Red, 4);
e.Graphics.DrawPath(myPen2, myPath2);
}
private:
void CloneExample( PaintEventArgs^ e )
{
// Set several markers in a path.
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->AddEllipse( 0, 0, 100, 200 );
myPath->AddLine( Point(100,100), Point(200,100) );
Rectangle rect = Rectangle(200,0,100,200);
myPath->AddRectangle( rect );
myPath->AddLine( Point(250,200), Point(250,300) );
// Draw the path to the screen.
Pen^ myPen = gcnew Pen( Color::Black,2.0f );
e->Graphics->DrawPath( myPen, myPath );
// Clone a copy of myPath.
GraphicsPath^ myPath2 = dynamic_cast<GraphicsPath^>(myPath->Clone());
// Draw the path to the screen.
Pen^ myPen2 = gcnew Pen( Color::Red,4.0f );
e->Graphics->DrawPath( myPen2, myPath2 );
}
private void CloneExample(PaintEventArgs e)
{
// Set several markers in a path.
GraphicsPath myPath = new GraphicsPath();
myPath.AddEllipse(0, 0, 100, 200);
myPath.AddLine(new Point(100, 100), new Point(200, 100));
Rectangle rect = new Rectangle(200, 0, 100, 200);
myPath.AddRectangle(rect);
myPath.AddLine(new Point(250, 200), new Point(250, 300));
// Draw the path to the screen.
Pen myPen = new Pen(Color.get_Black(), 2);
e.get_Graphics().DrawPath(myPen, myPath);
// Clone a copy of myPath.
GraphicsPath myPath2 = ((GraphicsPath)(myPath.Clone()));
// Draw the path to the screen.
Pen myPen2 = new Pen(Color.get_Red(), 4);
e.get_Graphics().DrawPath(myPen2, myPath2);
} //CloneExample
Plattformen
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
GraphicsPath-Klasse
GraphicsPath-Member
System.Drawing.Drawing2D-Namespace