GraphicsPath.AddPath(GraphicsPath, Boolean) Metoda
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Připojí zadaný GraphicsPath parametr k této cestě.
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)
Parametry
- addingPath
- GraphicsPath
Přidá GraphicsPath se.
- connect
- Boolean
Logická hodnota, která určuje, jestli je první obrázek v přidané cestě součástí posledního obrázku v této cestě. Hodnota true
určuje, že první obrázek v přidané cestě je (pokud je to možné) součástí posledního obrázku v této cestě. Hodnota false
určuje, že první obrázek v přidané cestě je oddělený od posledního obrázku v této cestě.
Příklady
Následující příklad kódu je navržený pro použití s model Windows Forms a vyžaduje PaintEventArgse
objekt OnPaint události . Kód provede následující akce:
Vytvoří dvě cesty, jednu trojúhelník vpravo nahoru a druhou trojúhelník nahoru a druhou trojúhelník nahoru a dolů.
Přidá druhou cestu k první.
Nakreslí výslednou cestu k obrazovce.
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
Platí pro
Váš názor
https://aka.ms/ContentUserFeedback.
Připravujeme: V průběhu roku 2024 budeme postupně vyřazovat problémy z GitHub coby mechanismus zpětné vazby pro obsah a nahrazovat ho novým systémem zpětné vazby. Další informace naleznete v tématu:Odeslat a zobrazit názory pro