Cursor.Hide Metoda

Definicja

Ukrywa kursor.

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

Przykłady

Poniższy przykład kodu ukrywa kursor, gdy wskaźnik myszy przechodzi do obszaru klienta przycisku. Podobnie, gdy wskaźnik myszy opuszcza obszar klienta przycisku, kursor jest wyświetlany ponownie. W tym przykładzie wymagany jest element FormButton o nazwie myButton.

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

Uwagi

Show Wywołania metod i Hide muszą być zrównoważone. Dla każdego wywołania Hide metody musi istnieć odpowiednie wywołanie Show metody .

Dotyczy

Zobacz też