Shape.Hide 方法
從使用者隱藏線條或圖案控制項。
命名空間: Microsoft.VisualBasic.PowerPacks
組件: Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
語法
'宣告
Public Sub Hide
public void Hide()
public:
void Hide()
member Hide : unit -> unit
public function Hide()
備註
隱藏控制項等於將 Visible 屬性設定為 false。後Hide呼叫方法時, Visible屬性會傳回值為false直到Show就會呼叫方法或直到Visible設定為 [ true。
範例
下列範例會示範如何使用Hide和Show在兩個圖形之間切換的方法執行時間。這個範例要求您必須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 命名空間
其他資源
HOW TO:使用 LineShape 控制項繪製線條 (Visual Studio)
HOW TO:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)