using
System.Runtime.InteropServices;
[DllImport("User32.DLL")]
public static extern bool SetSystemCursor(IntPtr hcur, uint id);
public const uint OCR_NORMAL = 32512;
public const uint OCR_IBEAM = 32513;
[DllImport("User32.DLL")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam,
IntPtr pvParam, uint fWinIni);
public const uint SPI_SETCURSORS = 87;
public const uint SPIF_SENDWININICHANGE = 2;
private void button1_Click(object sender, EventArgs e)
{
//设置
SetSystemCursor(Cursors.WaitCursor.CopyHandle(), OCR_NORMAL);
SetSystemCursor(Cursors.WaitCursor.CopyHandle(), OCR_IBEAM);
//..可以根据情况加
}
private void button2_Click(object sender, EventArgs e)
{
//恢复
SystemParametersInfo(SPI_SETCURSORS, 0, IntPtr.Zero, SPIF_SENDWININICHANGE);
}
转载地址:http://blog.sina.com.cn/s/blog_4bb791230100ad4o.html