Shape.Show 方法
對使用者顯示圖形。
命名空間: Microsoft.VisualBasic.PowerPacks
組件: Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
語法
'宣告
Public Sub Show
public void Show()
public:
void Show()
member Show : unit -> unit
public function Show()
備註
顯示控制項就相當於設定Visible屬性設為true。 之後Show呼叫方法時,Visible屬性會傳回值為true直到Hide呼叫方法或直到Visible設為false。
範例
下列範例示範如何使用Show和Hide方法切換兩個不同的圖形,在執行階段。 此範例中您需要RectangleShape名為 RectangleShape1 控制項和OvalShape名 OvalShape1 為表單上的控制項。 為求最佳效果,讓兩個控制項的大小相同,並置於彼此。
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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
如何:使用 LineShape 控制項繪製線條 (Visual Studio)