Cursor.Hide Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Hides the cursor.
public:
static void Hide();
public static void Hide ();
static member Hide : unit -> unit
Public Shared Sub Hide ()
Examples
The following code example hides the cursor when the mouse pointer enters the button's client area. Likewise, when the mouse pointer leaves the button's client area, the cursor is shown again. This example requires a Form with a Button named 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
Remarks
The Show and Hide method calls must be balanced. For every call to the Hide method there must be a corresponding call to the Show method.
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET