Partilhar via


Propriedade Shape.Visible

Obtém ou define um valor que indica se um controle de forma ou de linha é exibido.

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

Sintaxe

'Declaração
<BrowsableAttribute(True)> _
Public Property Visible As Boolean
[BrowsableAttribute(true)]
public bool Visible { get; set; }
[BrowsableAttribute(true)]
public:
property bool Visible {
    bool get ();
    void set (bool value);
}
[<BrowsableAttribute(true)>]
member Visible : bool with get, set
function get Visible () : boolean 
function set Visible (value : boolean)

Valor de propriedade

Tipo: Boolean
trueSe o controle é exibido; Caso contrário, false.O padrão é true.

Comentários

O Visible propriedade pode ser usada para fazer objetos gráficos criados usando um LineShape, OvalShape, ou RectangleShape controle aparecem e desaparecem em tempo de execução.

Exemplos

O exemplo a seguir demonstra como usar o Visible propriedade para alternar entre as duas formas diferentes em tempo de execução. Este exemplo requer que você tenha um RectangleShape controle denominado RectangleShape1 e um OvalShape controle denominado OvalShape1 em um formulário. Para obter melhores resultados, verifique ambos os controles do mesmo tamanho e posicionar um sobre o outro.

Private Sub ShapeVisible_Load() Handles MyBase.Load
    ' Hide the oval.
    OvalShape1.Visible = False 
End Sub 

Private Sub Shapes_Click() Handles RectangleShape1.Click,
                                   OvalShape1.Click

    If OvalShape1.Visible = True Then 
        ' Hide the oval.
        OvalShape1.Visible = False 
        ' Show the rectangle.
        RectangleShape1.Visible = True 
    Else 
        ' Hide the rectangle.
        RectangleShape1.Visible = False 
        ' Show the oval.
        OvalShape1.Visible = True 
    End If 
End Sub
private void ShapeVisible_Load(System.Object sender, System.EventArgs e)
{
    // Hide the oval.
    ovalShape1.Visible = false;
}

private void Shapes_Click(System.Object sender, System.EventArgs e)
{
    if (ovalShape1.Visible == true)
    // Hide the oval.
    {
        ovalShape1.Visible = false;
        // Show the rectangle.
        rectangleShape1.Visible = true;
    }
    else
    {
        // Hide the rectangle.
        rectangleShape1.Visible = false;
        // Show the oval.
        ovalShape1.Visible = true;
    }
}

Segurança do .NET Framework

Consulte também

Referência

Shape Classe

Namespace Microsoft.VisualBasic.PowerPacks

Outros recursos

Como desenhar linhas com o controle LineShape (Visual Studio)

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

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