GraphicsPath.GetLastPoint Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the last point in the PathPoints array of this GraphicsPath.
public:
System::Drawing::PointF GetLastPoint();
public System.Drawing.PointF GetLastPoint ();
member this.GetLastPoint : unit -> System.Drawing.PointF
Public Function GetLastPoint () As PointF
Returns
A PointF that represents the last point in this GraphicsPath.
Examples
The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e
, an OnPaint event object. The code creates a path, adds a line to the path, and then gets the last point in the path.
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
Applies to
Samarbeta med oss på GitHub
Källan för det här innehållet finns på GitHub, där du även kan skapa och granska ärenden och pull-begäranden. Se vår deltagarguide för mer information.