Share via


Shape.Hide Method ()

 

Conceals a line or shape control from the user.

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

Syntax

public void Hide()
public:
void Hide()
member Hide : unit -> unit
Public Sub Hide

Remarks

Hiding the control is equivalent to setting the Visible property to false. After the Hide method is called, the Visible property returns a value of false until the Show method is called or until Visible is set to true.

Examples

The following example demonstrates how to use the Hide and Show methods to switch between two shapes at run time. This example requires that you have a RectangleShape control named RectangleShape1 and an OvalShape control named OvalShape1 on a form. For best results, make both controls the same size and position one on top of the other.

private void Form1_Load(System.Object sender, System.EventArgs e)
{
    // Hide the oval.
    ovalShape1.Hide();
}

private void Shapes_Click(System.Object sender, System.EventArgs e)
{
    if (ovalShape1.Visible == true)
    // Hide the oval.
    {
        ovalShape1.Hide();
        // Show the rectangle.
        rectangleShape1.Show();
    }
    else
    {
        // Hide the rectangle.
        rectangleShape1.Hide();
        // Show the oval.
        ovalShape1.Show();
    }
}
Private Sub Form1_Load() Handles MyBase.Load
    ' Hide the oval.
    OvalShape1.Hide()
End Sub

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

    If OvalShape1.Visible = True Then
        ' Hide the oval.
        OvalShape1.Hide()
        ' Show the rectangle.
        RectangleShape1.Show()
    Else
        ' Hide the rectangle.
        RectangleShape1.Hide()
        ' Show the oval.
        OvalShape1.Show()
    End If
End Sub

See Also

Shape Class
Microsoft.VisualBasic.PowerPacks Namespace
How to: Draw Lines with the LineShape Control (Visual Studio)
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)
Introduction to the Line and Shape Controls (Visual Studio)

Return to top