LineShape.EndPoint-Eigenschaft

Ruft ab oder legt die Koordinaten Ende einer Zeile fest, die von einem LineShape-Steuerelement gezeichnet wird.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
<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)

Eigenschaftswert

Typ: System.Drawing.Point
Eine Point Struktur, die die Koordinaten Ende der Zeile darstellt.

Hinweise

Die Koordinaten sind relativ zum Container des Steuerelements LineShape und werden in Pixeln ausgedrückt.

Sie können die Ende Koordinaten ändern, indem Sie die X2 und Y2-Eigenschaften festlegen.

Beispiele

Im folgenden Beispiel wird LineShape aus einer horizontalen Ausrichtung einer diagonalen Ausrichtung und dann zu einer vertikalen Ausrichtung, mit StartPoint als Achse.

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-Sicherheit

Siehe auch

Referenz

LineShape Klasse

Microsoft.VisualBasic.PowerPacks-Namespace

ShapeContainer

Shape

Weitere Ressourcen

Gewusst wie: Zeichnen von Formen mit dem OvalShape-Steuerelement und dem RectangleShape-Steuerelement (Visual Studio)

Gewusst wie: Zeichnen von Linien mit dem LineShape-Steuerelement (Visual Studio)

Einführung in das Line-Steuerelement und das Shape-Steuerelement (Visual Studio)