using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;

namespace WindowsApplication1
{
public class Form1 : Form
{
[DllImport("user32.dll")]
static extern IntPtr LoadCursorFromFile(string fileName);

public Form1()
{
InitializeComponent();
}

/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows 窗体设计器生成的代码

/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 273);
this.Name = "Form1";
this.Text = "Form1";
this.Click += new System.EventHandler(this.Form1_Click);
this.ResumeLayout(false);

}

#endregion

int i = 0;
private void Form1_Click(object sender, EventArgs e)
{
i++;
if (i % 2 == 1)
Cursor.Hide();
else
{
Cursor.Show();
i = 0;
}
//Cursor = new Cursor("Arrow.ani");
Cursor customCursor = new Cursor(Cursor.Current.Handle);
IntPtr customCursorHandle = LoadCursorFromFile("Arrow.ani");
customCursor.GetType().InvokeMember("handle", BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.Instance |
BindingFlags.SetField, null, customCursor,
new object[] { customCursorHandle });
this.Cursor = customCursor;
}
}
}

使用预设半透明鼠标Cursor的更多相关文章

  1. 自定义鼠标Cursor转变成图片

    今天无意做到项目遇到一个好玩的事情,就是当我鼠标移到一个链接上面,并不是像正常那样出现一个小手,而是变成一个小十字架, 下面看图当时第一眼看到总感觉哪里不对,噢噢噢噢 这样的 小手没了,居然是一个图片 ...

  2. css之鼠标cursor

    <html> <body> <p>请把鼠标移动到单词上,可以看到鼠标指针发生变化:</p> <span style="cursor:au ...

  3. css3-5 css3鼠标、列表和尺寸样式怎么用(文字有关的样式会被继承)

    css3-5  css3鼠标.列表和尺寸样式怎么用(文字有关的样式会被继承) 一.总结 一句话总结:css标签中文字有关的样式会被继承.由常用样式记起. 1.鼠标常用样式有哪些? cursor:poi ...

  4. 11种常用css样式之鼠标、列表和尺寸样式学习

    鼠标cursor常见样式crosshair;/*十字形状*/cursor:pointer;/*小手形状*/cursor:wait;/*等待形状*/cursor:text;/*默认 文本形状*/curs ...

  5. 屏幕 Dynpro

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  6. Unity3D 敌人AI 和 动画( Animator )系统的实例讲解

    在这个实例中,我们要做一些敌人AI的简单实现,其中自动跟随和动画是重点,我们要达到的目标如下: 1.敌人能够自动跟随主角 2.敌人模型一共有四个动作:Idle(空闲) Run(奔跑) Attack(攻 ...

  7. HTML 常见代码整合;

    html+css代码 文本设置 1.font-size: 字号参数 2.font-style: 字体格式 3.font-weight: 字体粗细 4.颜色属性 color: 参数 注意使用网页安全色 ...

  8. MFC学习 修改窗口样式

    1. 在PreCreateWindow中可用CREATESTRUCT cs, cs.lpszName修改窗口标题, cs.lpszClass = AfxRegisterWndClass 修改图标与样式 ...

  9. C#获取网页中某个元素的位置,并模拟点击

    我们在开发中,往往要得到网页中某个元素的位置,并且点击它.要模拟一次鼠标点击并不难,只要调用一个API就行了,关键就是怎么样得到这个元素的位置,还有判断是否要滚动滚动条,要滚动多少行能让元素显示出来. ...

随机推荐

  1. 使用nodejs创建Marketing Cloud的contact数据

    源代码如下: var config = require("./mcConfig"); var request = require('request'); var url = con ...

  2. 处理器拦截器(HandlerInterceptor)详解(转)

    简介 SpringWebMVC的处理器拦截器,类似于Servlet开发中的过滤器Filter,用于处理器进行预处理和后处理. 应用场景 1.日志记录,可以记录请求信息的日志,以便进行信息监控.信息统计 ...

  3. python 中startswith()和endswith() 方法

    startswith()方法 Python startswith() 方法用于检查字符串是否是以指定子字符串开头如果是则返回 True,否则返回 False.如果参数 beg 和 end 指定值,则在 ...

  4. 利用FastReport直接生成条码

    procedure TForm1.Button1Click(Sender: TObject); var x:TfrxbarCodeView; begin x:=TfrxbarCodeView.Crea ...

  5. 记录lucene.net的使用过程

    之前公司要做一个信息展示的网站,领导说要用lucene.net来实现全文检索,类似百度的搜索功能,但是本人技术有限,只是基本实现搜索和高亮功能,特此记录: 先看下页面效果,首先我搜索“为什么APP消息 ...

  6. 《浏览器工作原理与实践》<04>从输入URL到页面展示,这中间发生了什么?

    “在浏览器里,从输入 URL 到页面展示,这中间发生了什么? ”这是一道经典的面试题,能比较全面地考察应聘者知识的掌握程度,其中涉及到了网络.操作系统.Web 等一系列的知识. 在面试应聘者时也必问这 ...

  7. new Function()语法

    函数的语法: let func = new Function(...args, body); 历史原因,参数也可以以逗号分隔的列表的形式给出,这三个意思相同: new Function('a', 'b ...

  8. E - GCD HDU - 2588

    The greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the ...

  9. thymeleaf小知识

    1.根据不同性别,显明不同的默认图片:th:if th:src   图片路径 <img th:if="${gender=='男'}" id="admission_p ...

  10. SpringMVC——问题汇总

    1.html页面ajax请求/login.后台报: Request method 'GET' not supported 原因: 后台请求使用了method = POST,但是url请求没有formd ...