Shape.Show Method
Displays a shape to the user.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
'宣告
Public Sub Show
public void Show()
public:
void Show()
member Show : unit -> unit
public function Show()
Remarks
Showing the control is equivalent to setting the Visible property to true. After the Show method is called, the Visible property returns a value of true until the Hide method is called or until Visible is set to false.
Examples
The following example demonstrates how to use the Show and Hide methods to switch between two different 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 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
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();
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualBasic.PowerPacks Namespace
Other Resources
How to: Draw Lines with the LineShape Control (Visual Studio)
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)