GraphicsPath.GetLastPoint 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取此 GraphicsPath的 PathPoints 数组中的最后一个点。
public:
System::Drawing::PointF GetLastPoint();
public System.Drawing.PointF GetLastPoint ();
member this.GetLastPoint : unit -> System.Drawing.PointF
Public Function GetLastPoint () As PointF
返回
表示此 GraphicsPath的最后一个点的 PointF。
示例
下面的代码示例旨在与 Windows 窗体一起使用,它需要 PaintEventArgse
OnPaint 事件对象。 该代码创建路径,向路径添加一行,然后获取路径中的最后一个点。
private:
void GetLastPointExample( PaintEventArgs^ /*e*/ )
{
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->AddLine( 20, 20, 100, 20 );
PointF lastPoint = myPath->GetLastPoint();
if ( lastPoint.IsEmpty == false )
{
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 == false)
{
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