共用方式為


Cursor.Show 方法

定義

顯示游標。

public:
 static void Show();
public static void Show ();
static member Show : unit -> unit
Public Shared Sub Show ()

範例

下列程式碼範例會在滑鼠指標進入按鈕的工作區時隱藏游標。 同樣地,當滑鼠指標離開按鈕的工作區時,會再次顯示游標。 此範例需要 Form 具有具名 myButtonButton

private:
   void myButton_MouseEnter( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      // Hide the cursor when the mouse pointer enters the button.
      ::Cursor::Hide();
   }

   void myButton_MouseLeave( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      // Show the cursor when the mouse pointer leaves the button.
      ::Cursor::Show();
   }
private void myButton_MouseEnter(object sender, System.EventArgs e)
{
   // Hide the cursor when the mouse pointer enters the button.
   Cursor.Hide();
}

private void myButton_MouseLeave(object sender, System.EventArgs e)
{
   // Show the cursor when the mouse pointer leaves the button.
   Cursor.Show();
}
Private Sub myButton_MouseEnter(sender As Object, e As System.EventArgs) Handles myButton.MouseEnter
   ' Hide the cursor when the mouse pointer enters the button.
   Cursor.Hide()
End Sub
      
      
Private Sub myButton_MouseLeave(sender As Object, e As System.EventArgs) Handles myButton.MouseLeave
   ' Show the cursor when the mouse pointer leaves the button.
   Cursor.Show()
End Sub

備註

ShowHide 方法呼叫必須平衡。 對於方法的每個呼叫 Hide ,都必須有對 方法的 Show 對應呼叫。

適用於

另請參閱