LineShape.EndPoint 屬性
取得或設定繪製線條的結束座標LineShape控制項。
命名空間: Microsoft.VisualBasic.PowerPacks
組件: Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
語法
'宣告
<BrowsableAttribute(False)> _
Public Property EndPoint As Point
[BrowsableAttribute(false)]
public Point EndPoint { get; set; }
[BrowsableAttribute(false)]
public:
property Point EndPoint {
Point get ();
void set (Point value);
}
[<BrowsableAttribute(false)>]
member EndPoint : Point with get, set
function get EndPoint () : Point
function set EndPoint (value : Point)
屬性值
類型:Point
APoint表示線條的結束座標的結構。
備註
座標是相對於容器的LineShape控制項,並以像素表示。
範例
下列範例參數LineShape水平方向的對角線方向,然後以垂直方向,從使用StartPoint做為軸。
Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
Dim line1 As New Microsoft.VisualBasic.PowerPacks.LineShape(10, 10, 200, 10)
Private Sub Form1_Load() Handles MyBase.Load
' Set the form as the parent of the ShapeContainer.
canvas.Parent = Me
' Set the ShapeContainer as the parent of the LineShape.
line1.Parent = canvas
End Sub
Private Sub Form1_Click() Handles Me.Click
ChangeOrientation()
End Sub
Private Sub ChangeOrientation()
Static direction As String = "horizontal"
If direction = "horizontal" Then
' Change the orientation to diagonal.
line1.EndPoint = New System.Drawing.Point(200, 200)
direction = "diagonal"
ElseIf direction = "diagonal" Then
' Change the orientation to vertical.
line1.EndPoint = New System.Drawing.Point(line1.X1, 200)
direction = "vertical"
Else
' Change the orientation to horizontal.
line1.EndPoint = New System.Drawing.Point(200, line1.Y1)
direction = "horizontal"
End If
End Sub
Microsoft.VisualBasic.PowerPacks.ShapeContainer canvas =
new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
Microsoft.VisualBasic.PowerPacks.LineShape line1 =
new Microsoft.VisualBasic.PowerPacks.LineShape(10, 10, 200, 10);
string direction;
private void Form1_Load(System.Object sender, System.EventArgs e)
{
// Set the form as the parent of the ShapeContainer.
canvas.Parent = this;
// Set the ShapeContainer as the parent of the LineShape.
line1.Parent = canvas;
direction = "horizontal";
}
private void Form1_Click(object sender, System.EventArgs e)
{
ChangeOrientation();
}
private void ChangeOrientation()
{
if (direction == "horizontal")
// Change the orientation to diagonal.
{
line1.EndPoint = new System.Drawing.Point(200, 200);
direction = "diagonal";
}
else if (direction == "diagonal")
{
line1.EndPoint = new System.Drawing.Point(line1.X1, 200);
direction = "vertical";
}
else
{
// Change the orientation to horizontal.
line1.EndPoint = new System.Drawing.Point(200, line1.Y1);
direction = "horizontal";
}
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
如何:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)