zoukankan      html  css  js  c++  java
  • 鼠标图标:c#定义鼠标为指定的动画图标(转)

    鼠标图标:c#定义鼠标为指定的动画图标

    来源: 发布时间:星期五, 2009年1月9日 浏览:14次 评论:0
      在Windows窗体中通过设置Control控件属性无法将鼠标设置为动画图标形式如果要实现该功能可以通过APILoadCursorFromFile和SetClassLong实现这两个声明代码如下:

    [DllImport("user32", EntryPo = "LoadCursorFromFile")]
        public extern LoadCursorFromFile( lpFileName);
        [DllImport("user32", EntryPo = "SetCursor")]
        public extern void SetCursor( hcur, i);
      注意:API需要导入using .Runtime.InteropServices命名空间   举例  定义鼠标为指定动画图标

      本举例实现运行时候当鼠标移动到窗体上时鼠标显示动画效果

      主要代码如下

    private void frmPicut_Load(object sender, EventArgs e)
        {
           reportPath = Application.StartupPath.Sub(0, Application.StartupPath.Sub(0,
        Application.StartupPath.LastIndexOf("")).LastIndexOf(""));
          reportPath @"sl3210mouse.ani";
           cur = LoadCursorFromFile(reportPath);
          SetCursor(cur, 32512);
        }
        private void frmPicut_FormClosing(object sender, FormClosingEventArgs e)
        {
           cur = LoadCursorFromFile(@"C:WINDOWSCursorsarrow_m.cur");
          SetCursor(cur, 32512);    }

    http://www.crazycoder.cn/DotNet/Article49035.html
  • 相关阅读:
    etcd的原理分析
    (转)Linux sort命令
    随机森林
    python 类的定义和继承
    python random
    Spark源码阅读(1): Stage划分
    Mac 上安装MySQL
    Python 删除 数组
    在循环中将多列数组组合成大数组
    准确率 召回率
  • 原文地址:https://www.cnblogs.com/xianyin05/p/1439523.html
Copyright © 2011-2022 走看看