Propriedade LineShape.StartPoint

Obtém ou define as coordenadas iniciais de uma linha desenhada por um LineShape controle.

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

Sintaxe

'Declaração
<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)

Valor de propriedade

Tipo: System.Drawing.Point
A Point estrutura que representa as coordenadas iniciais da linha.

Comentários

As coordenadas são relativas ao contêiner da LineShape de controle e são expressas em pixels.

Você também pode alterar as coordenadas iniciais, definindo a X1 e Y1 propriedades.

Exemplos

As seguintes opções de exemplo um LineShape a partir de uma orientação horizontal a uma orientação diagonal e, em seguida, a uma orientação vertical, usando o EndPoint como um eixo.

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";
            }
        }

Segurança do .NET Framework

Consulte também

Referência

LineShape Classe

Namespace Microsoft.VisualBasic.PowerPacks

ShapeContainer

Shape

Outros recursos

Como: desenhar formas com os controles de RectangleShape (Visual Studio) e o OvalShape

Como: desenhar linhas com o controle de LineShape (Visual Studio)

Introdução à linha e controles Shape (Visual Studio)