Cursor.Hide 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
隐藏光标。
public:
static void Hide();
public static void Hide();
static member Hide : unit -> unit
Public Shared Sub Hide ()
示例
下面的代码示例在鼠标指针进入按钮的工作区时隐藏光标。 同样,当鼠标指针离开按钮的工作区时,将再次显示光标。 此示例需要Form具有命名Button的 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
注解
和ShowHide方法调用必须均衡。 对于对方法的每个调用 Hide ,都必须有对该方法的 Show 相应调用。