GraphicsPath.GetLastPoint Methode

Definitie

Hiermee haalt u het laatste punt op in de PathPoints matrix van deze GraphicsPath.

public:
 System::Drawing::PointF GetLastPoint();
public System.Drawing.PointF GetLastPoint();
member this.GetLastPoint : unit -> System.Drawing.PointF
Public Function GetLastPoint () As PointF

Retouren

Een PointF die het laatste punt in dit GraphicsPathvoorstel vertegenwoordigt.

Voorbeelden

Het volgende codevoorbeeld is ontworpen voor gebruik met Windows Forms en vereist PaintEventArgse, een OnPaint-gebeurtenisobject. De code maakt een pad, voegt een regel toe aan het pad en haalt vervolgens het laatste punt in het pad op.

private:
   void GetLastPointExample( PaintEventArgs^ /*e*/ )
   {
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->AddLine( 20, 20, 100, 20 );
      PointF lastPoint = myPath->GetLastPoint();
      if ( !lastPoint.IsEmpty )
      {
         String^ lastPointXString = lastPoint.X.ToString();
         String^ lastPointYString = lastPoint.Y.ToString();
         MessageBox::Show( String::Concat( lastPointXString, ", ", lastPointYString ) );
      }
      else
            MessageBox::Show( "lastPoint is empty" );
   }
private void GetLastPointExample(PaintEventArgs e)
{
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddLine(20, 20, 100, 20);
    PointF lastPoint = myPath.GetLastPoint();
    if(!lastPoint.IsEmpty)
    {
        string lastPointXString = lastPoint.X.ToString();
        string lastPointYString = lastPoint.Y.ToString();
        MessageBox.Show(lastPointXString + ", " + lastPointYString);
    }
    else
    {
        MessageBox.Show("lastPoint is empty");
    }
}
Public Sub GetLastPointExample(ByVal e As PaintEventArgs)
    Dim myPath As New GraphicsPath
    myPath.AddLine(20, 20, 100, 20)
    Dim lastPoint As PointF = myPath.GetLastPoint()
    If lastPoint.IsEmpty = False Then
        Dim lastPointXString As String = lastPoint.X.ToString()
        Dim lastPointYString As String = lastPoint.Y.ToString()
        MessageBox.Show((lastPointXString + ", " + lastPointYString))
    Else
        MessageBox.Show("lastPoint is empty")
    End If
End Sub

Van toepassing op