Proprietà LineShape.Y2

Ottiene o imposta la coordinata Y del punto finale di una linea tracciata da un oggetto LineShape controllare.

Spazio dei nomi:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Sintassi

'Dichiarazione
<BrowsableAttribute(True)> _
Public Property Y2 As Integer
[BrowsableAttribute(true)]
public int Y2 { get; set; }
[BrowsableAttribute(true)]
public:
property int Y2 {
    int get ();
    void set (int value);
}
[<BrowsableAttribute(true)>]
member Y2 : int with get, set
function get Y2 () : int
function set Y2 (value : int)

Valore proprietà

Tipo: System.Int32
Integer che rappresenta la coordinata (verticale) Y del punto finale della linea.

Note

Coordinata è relativo al contenitore di LineShape controllare e sono espresse in pixel.

È inoltre possibile modificare le coordinate finali impostando EndPoint proprietà.

Esempi

Nell'esempio seguente viene illustrato come modificare la direzione di una riga in diagonale modificando X1, Y1, X2e Y2 proprietà.

Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
Dim line1 As New Microsoft.VisualBasic.PowerPacks.LineShape(10, 10,
    200, 10)
Private Sub LineDirection_Load(ByVal sender As System.Object,
    ByVal e As System.EventArgs) 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 LineDirection_Click(ByVal sender As Object,
    ByVal e As System.EventArgs) Handles Me.Click
    ChangeDirection()
End Sub
Private Sub ChangeDirection()
    If line1.X1 = line1.Y2 Then
        line1.X2 = 10
        line1.Y2 = 200
    Else
        line1.X2 = 200
        line1.Y2 = 10
    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);
private void LineDirection_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;
}
private void LineDirection_Click(object sender, System.EventArgs e)
{
    ChangeDirection();
}
private void ChangeDirection()
{
    if (line1.X1 == line1.Y2)
    {
        line1.X2 = 10;
        line1.Y2 = 200;
    }
    else
    {
        line1.X2 = 200;
        line1.Y2 = 10;
    }
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

LineShape Classe

Spazio dei nomi Microsoft.VisualBasic.PowerPacks

ShapeContainer

Shape

Altre risorse

Procedura: disegnare forme con i controlli OvalShape e RectangleShape (Visual Studio)

Procedura: disegnare linee con il controllo LineShape (Visual Studio)

Introduzione ai controlli Line e Shape (Visual Studio)