共用方式為


LineShape.StartPoint 屬性

取得或設定由繪製一條線的起始座標LineShape控制項。

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
<BrowsableAttribute(False)> _
Public Property StartPoint As Point
[BrowsableAttribute(false)]
public Point StartPoint { get; set; }
[BrowsableAttribute(false)]
public:
property Point StartPoint {
    Point get ();
    void set (Point value);
}
[<BrowsableAttribute(false)>]
member StartPoint : Point with get, set
function get StartPoint () : Point 
function set StartPoint (value : Point)

屬性值

類型:Point
APoint表示線條的起始座標的結構。

備註

座標是相對於容器的LineShape控制項,並以像素表示。

您也可以藉由設定變更的起始座標X1Y1屬性。

範例

下列範例參數LineShape水平方向的對角線方向,然後以垂直方向,從使用EndPoint做為軸。

Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
Dim line1 As New Microsoft.VisualBasic.PowerPacks.LineShape(10, 10, 200, 10)

Private Sub RotateLine2_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 RotateLine2_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.StartPoint = New System.Drawing.Point(line1.X1, 200)
        direction = "diagonal" 
    ElseIf direction = "diagonal" Then 
        ' Change the orientation to vertical.
        line1.StartPoint = New System.Drawing.Point(line1.Y1, 200)
        direction = "vertical" 
    Else 
        ' Change the orientation to horizontal.
        line1.StartPoint = New System.Drawing.Point(10, line1.Y2)
        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 RotateLine2_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 RotateLine2_Click(object sender, System.EventArgs e)
        {
            ChangeOrientation();
        }

        private void ChangeOrientation()
        {

            if (direction == "horizontal")
            // Change the orientation to diagonal.
            {
                line1.StartPoint = new System.Drawing.Point(line1.X1, 200);
                direction = "diagonal";
            }
            else if (direction == "diagonal")
            {
                line1.StartPoint = new System.Drawing.Point(line1.Y1, 200);
                direction = "vertical";
            }
            else
            {
                // Change the orientation to horizontal.
                line1.StartPoint = new System.Drawing.Point(10, line1.Y2);
                direction = "horizontal";
            }
        }

.NET Framework 安全性

請參閱

參考

LineShape 類別

Microsoft.VisualBasic.PowerPacks 命名空間

ShapeContainer

Shape

其他資源

如何:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)

如何:使用 LineShape 控制項繪製線條 (Visual Studio)

Line 和 Shape 控制項簡介 (Visual Studio)