次の方法で共有


GraphicsPath.GetLastPoint メソッド

この GraphicsPath オブジェクトの PathPoints 配列内の最後の点を取得します。

Public Function GetLastPoint() As PointF
[C#]
public PointF GetLastPoint();
[C++]
public: PointF GetLastPoint();
[JScript]
public function GetLastPoint() : PointF;

戻り値

GraphicsPath オブジェクトの最後の点を表す PointF 構造体。

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 OnPaint イベントのオブジェクトである PaintEventArgs e が必要です。このコードはパスを作成し、そのパスに直線を追加してから、パスの最後の点を取得します。

 
Public Sub GetLastPointExample(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
        
[C#] 
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");
}
        

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

GraphicsPath クラス | GraphicsPath メンバ | System.Drawing.Drawing2D 名前空間