1、添加命名空间
using System.Runtime.InteropServices;
2、添加DLL引用
/// <summary>
/// 控制鼠标指针显示和隐藏
/// </summary>
public class MousePointer
{
/// <summary>
/// 调用系统API函数操作鼠标指针
/// </summary>
/// <param name="status">0表示隐藏鼠标指针,1表示显示鼠标指针</param>
[DllImport("user32.dll", EntryPoint = "ShowCursor", CharSet = CharSet.Auto)]
public static extern void ShowCursor(int status);
}``