标题:如何改变鼠标样式
只看楼主
wsq1168
Rank: 1
等 级:新手上路
帖 子:72
专家分:0
注 册:2007-8-24
 问题点数:0 回复次数:1 
如何改变鼠标样式
如何改变鼠标样式比如改变成图片心型等
搜索更多相关主题的帖子: 鼠标 样式 
2008-05-27 17:24
沉沦过迁
Rank: 2
来 自:广西百色
等 级:论坛游民
帖 子:2297
专家分:10
注 册:2007-5-8
得分:0 
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;


namespace GameLink.GameClass
{
    /// <summary>
    /// 自定义鼠标样式
    /// 可以是彩色 动画==
    /// </summary>
    class MouseStyle
    {
        [DllImport("user32.dll")]
        public static extern IntPtr LoadCursorFromFile(string filename);

        [DllImport("user32.dll")]
        public static extern IntPtr SetCursor(IntPtr cursorHandle);

        [DllImport("user32.dll")]
        public static extern uint DestroyCursor(IntPtr cursorHandle);

        public MouseStyle()
        {
        }
        public Cursor MyMouseStyle(string filename)
        {
            Cursor myCursor = new Cursor(Cursor.Current.Handle);
            IntPtr colorCursorHandle = LoadCursorFromFile(filename);
            myCursor.GetType().InvokeMember("handle", BindingFlags.Public |
                BindingFlags.NonPublic | BindingFlags.Instance |
                BindingFlags.SetField, null, myCursor, new object[] { colorCursorHandle });
            return myCursor;
        }
    }
}


给你一个类你自己调用哟

也许我没有明天,但是我拥有现在
2008-05-27 17:44



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-216177-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.418352 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved