zoukankan      html  css  js  c++  java
  • C#开发分享:如何改变系统鼠标样式

    开发过程中发现需要用到改变鼠标样式(就是光标的样子),但是在网上找了很多资料,都是介绍在程序中使用,我需要的效果时在系统级使用。现在找到了,分享给大家。

     1         [DllImport("user32")]
     2         private static extern IntPtr LoadCursorFromFile(string fileName);
     3 
     4         [DllImport("User32.DLL")]
     5         public static extern bool SetSystemCursor(IntPtr hcur, uint id);
     6         public const uint OCR_NORMAL = 32512;
     7 
     8         [DllImport("User32.DLL")]
     9         public static extern bool SystemParametersInfo(uint uiAction, uint uiParam,IntPtr pvParam, uint fWinIni);
    10 
    11         public const uint SPI_SETCURSORS = 87;
    12         public const uint SPIF_SENDWININICHANGE = 2;
    13 
    14         private void button_Click(object sender, RoutedEventArgs e)
    15         {
    16             //设置
    17             IntPtr iP = LoadCursorFromFile(@"D:My Files图片cursor.cur");
    18             SetSystemCursor(iP, OCR_NORMAL);
    19         }
    20 
    21         private void button1_Click(object sender, RoutedEventArgs e)
    22         {
    23             //恢复
    24             SystemParametersInfo(SPI_SETCURSORS, 0, IntPtr.Zero, SPIF_SENDWININICHANGE);
    25         }
  • 相关阅读:
    loadrunner测试结果分析
    规范的测试流程
    B/S架构与C/S架构的区别
    Jemter性能测试
    Android Monkey压力测试介绍
    APP测试总结
    APP测试要点
    数据库常用的操作命令
    Mysql删除表格之后,进行恢复
    Android反编译工具
  • 原文地址:https://www.cnblogs.com/ansijiu/p/5712072.html
Copyright © 2011-2022 走看看