Compartir a través de


RectangleShape (Clase)

Actualización: noviembre 2007

Representa un control mostrado como un cuadrado, rectángulo, cuadrado redondeado o rectángulo redondeado.

Espacio de nombres:  Microsoft.VisualBasic.PowerPacks
Ensamblado:  Microsoft.VisualBasic.PowerPacks.Vs (en Microsoft.VisualBasic.PowerPacks.Vs.dll)

Sintaxis

<ToolboxBitmapAttribute(GetType(RectangleShape), "Microsoft.VisualBasic.PowerPacks.RectangleShape.bmp")> _
Public Class RectangleShape _
    Inherits SimpleShape

Dim instance As RectangleShape
[ToolboxBitmapAttribute(typeof(RectangleShape), "Microsoft.VisualBasic.PowerPacks.RectangleShape.bmp")]
public class RectangleShape : SimpleShape
[ToolboxBitmapAttribute(typeof(RectangleShape), L"Microsoft.VisualBasic.PowerPacks.RectangleShape.bmp")]
public ref class RectangleShape : public SimpleShape
public class RectangleShape extends SimpleShape

Comentarios

El control RectangleShape le permite dibujar rectángulos en un formulario o contenedor en tiempo de diseño o en tiempo de ejecución.

Cuando se agrega un control de línea o forma a un formulario o contenedor, se crea un objeto ShapeContainer invisible. ShapeContainer actúa como una superficie de dibujo para las formas incluidas en cada control contenedor. Cada ShapeContainer tiene un ShapeCollection correspondiente que le permite recorrer en iteración los controles de líneas y formas contenidos en ShapeContainer.

Al crear un control RectangleShape en tiempo de ejecución, debe crear también un objeto ShapeContainer y establecer la propiedad Parent de RectangleShape en ShapeContainer.

Ejemplos

En el siguiente ejemplo se crean un ShapeContainer y un RectangleShape, se agregan a un formulario y se muestra un rectángulo.

Private Sub DrawRectangle()
    Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
    Dim rect1 As New Microsoft.VisualBasic.PowerPacks.RectangleShape
    ' Set the form as the parent of the ShapeContainer.
    canvas.Parent = Me
    ' Set the ShapeContainer as the parent of the RectangleShape.
    rect1.Parent = canvas
    ' Set the location and size of the rectangle.
    rect1.Left = 10
    rect1.Top = 10
    rect1.Width = 300
    rect1.Height = 100
End Sub
private void DrawRectangle()
{
    Microsoft.VisualBasic.PowerPacks.ShapeContainer canvas = 
        new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
    Microsoft.VisualBasic.PowerPacks.RectangleShape rect1 = 
        new Microsoft.VisualBasic.PowerPacks.RectangleShape();
    // Set the form as the parent of the ShapeContainer.
    canvas.Parent = this;
    // Set the ShapeContainer as the parent of the RectangleShape.
    rect1.Parent = canvas;
    // Set the location and size of the rectangle.
    rect1.Left = 10;
    rect1.Top = 10;
    rect1.Width = 300;
    rect1.Height = 100;
}

Jerarquía de herencia

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      Microsoft.VisualBasic.PowerPacks.Shape
        Microsoft.VisualBasic.PowerPacks.SimpleShape
          Microsoft.VisualBasic.PowerPacks.RectangleShape

Seguridad para subprocesos

Todos los miembros static (Shared en Visual Basic) públicos de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Vea también

Referencia

RectangleShape (Miembros)

Microsoft.VisualBasic.PowerPacks (Espacio de nombres)

Otros recursos

Introducción a los controles de líneas y formas (Visual Studio)

Cómo: Dibujar líneas con el control LineShape (Visual Studio)

Cómo: Dibujar formas con los controles OvalShape y RectangleShape (Visual Studio)