zoukankan      html  css  js  c++  java
  • C# winform 自定义鼠标图标

     //设置鼠标图标
                Bitmap a = (Bitmap)Bitmap.FromFile("1.png");
                SetCursor(a, new Point(16, 36)); //new Point() 定义鼠标的可用点位置。

     

      //设置鼠标函数
            public void SetCursor(Bitmap cursor, Point hotPoint)
            {
                int hotX = hotPoint.X;
                int hotY = hotPoint.Y;
                Bitmap myNewCursor = new Bitmap(cursor.Width * 2 - hotX, cursor.Height * 2 - hotY);
                Graphics g = Graphics.FromImage(myNewCursor);
                g.Clear(Color.FromArgb(0, 0, 0, 0));
                g.DrawImage(cursor, cursor.Width - hotX, cursor.Height - hotY, cursor.Width,
                cursor.Height);

                this.Cursor = new Cursor(myNewCursor.GetHicon());

                g.Dispose();
                myNewCursor.Dispose();
            }

  • 相关阅读:
    如何添加动画效果
    iQuery高版本不兼容旋转木马插件问题
    splice方法可以实现增删改功能
    swiper.js实现轮播图效果
    MySQL | 操作表数据
    MySQL | 高级查询
    MySQL | 基本查询
    MySQL | 表函数
    MySQL | 表约束
    MySQL | 操作表
  • 原文地址:https://www.cnblogs.com/wpf123/p/2171273.html
Copyright © 2011-2022 走看看