Cursor.Show 方法

显示光标。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Shared Sub Show
用法

Cursor.Show
public static void Show ()
public:
static void Show ()
public static void Show ()
public static function Show ()

备注

Show 方法和 Hide 方法的调用必须平衡。对 Hide 方法的每一调用,均必须对应有一个对 Show 方法的调用。

示例

下面的代码示例在鼠标指针进入按钮的工作区时隐藏光标。同样地,当鼠标指针离开按钮的工作区时,光标就会再次显示。此示例要求有一个 Form,它包含一个名为 myButtonButton

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 'myButton_MouseEnter
      
      
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 'myButton_MouseLeave
      
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:
   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();
} //myButton_MouseEnter

private void myButton_MouseLeave(Object sender, System.EventArgs e)
{
    // Show the cursor when the mouse pointer leaves the button.
    Cursor.Show();
} //myButton_MouseLeave

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

Cursor 类
Cursor 成员
System.Windows.Forms 命名空间
Hide