Classe RectangleShape

Representa um controle exibido sistema autônomo um quadrado, retângulo, arredondado quadrado ou retângulo arredondado.

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

Sintaxe

<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

Comentários

The RectangleShape controle permite que você desenhar retângulos em um formulário ou o contêiner em time de design ou time de execução.

Quando você adiciona um controle de linha ou forma a um formulário ou contêiner, um invisível ShapeContainer objeto é criado. The ShapeContainer atua sistema autônomo uma superfície de desenho para sistema autônomo formas dentro de cada caixa de controles. Cada ShapeContainer tem um correspondente ShapeCollection que permite que você percorrer os controles de linha e forma que estão contidos na ShapeContainer.

Quando você cria um RectangleShape controle em time de execução, você também deve criar um ShapeContainer e defina o Parent propriedade das RectangleShape para o ShapeContainer.

Exemplos

O exemplo a seguir cria um ShapeContainer e um RectangleShape, adiciona-los a um formulário e exibe um retângulo.

PrivateSub DrawRectangle()
    Dim canvas AsNew Microsoft.VisualBasic.PowerPacks.ShapeContainer
    Dim rect1 AsNew 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
EndSub
privatevoid 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;
}

Hierarquia de herança

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

Acesso thread-safe

Quaisquer membros static (Shared no Visual Basic) públicos deste tipo são thread-safe. Não há garantia de que qualquer membro de instância seja thread-safe.

Consulte também

Referência

Membros RectangleShape

Namespace Microsoft.VisualBasic.PowerPacks

Outros recursos

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

Como: Desenhar linhas com o Controlarar de LineShape (Visual Studio)

Como: Desenhar formas com a OvalShape e controles de RectangleShape (Visual Studio)