Nota:
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
Obtiene o establece las coordenadas del final de una línea dibujada por un control de LineShape .
Espacio de nombres: Microsoft.VisualBasic.PowerPacks
Ensamblado: Microsoft.VisualBasic.PowerPacks.Vs (en Microsoft.VisualBasic.PowerPacks.Vs.dll)
Sintaxis
'Declaración
<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)
Valor de propiedad
Tipo: System.Drawing.Point
Una estructura de Point que representa las coordenadas de fin de línea.
Comentarios
Las coordenadas son relativas al contenedor del control de LineShape y se expresan en píxeles.
También puede cambiar las coordenadas de cierre estableciendo las propiedades de X2 y de Y2 .
Ejemplos
El ejemplo siguiente se cambia LineShape de una orientación horizontal a una orientación diagonal, y después a una orientación vertical, mediante StartPoint como eje.
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";
}
}
Seguridad de .NET Framework
- Plena confianza para el llamador inmediato. Un código de confianza parcial no puede utilizar este miembro. Para obtener más información, vea Utilizar bibliotecas de código que no es de plena confianza.
Vea también
Referencia
Microsoft.VisualBasic.PowerPacks (Espacio de nombres)
Otros recursos
Cómo: Dibujar formas con los controles OvalShape y RectangleShape (Visual Studio)
Cómo: Dibujar líneas con el control LineShape (Visual Studio)
Introducción a los controles de líneas y formas (Visual Studio)