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();
            }

  • 相关阅读:
    初级Linux学习指南
    2016/09/29 SQL中的join
    2016/09/27 Hadoop Yarn
    2016/06/27 HDFS概述
    2016/09/26 电能和电功率
    【转】2016/09/22 MapReduce初级案例
    2016/09/22 mapreduce
    2016/09/21 java关键字static
    2016/09/21 Java关键字final
    2016/09/21 java split用法
  • 原文地址:https://www.cnblogs.com/wpf123/p/2171273.html
Copyright © 2011-2022 走看看