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();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
             //传入鼠标自定义位图
            Bitmap a = (Bitmap)Bitmap.FromFile("锤子.png");
           //调用函数
            SetCursor(a, new Point(0, 0));
        }

          ----来自凌波小屋的笔记

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2021-05-23
  • 2021-12-06
猜你喜欢
  • 2022-03-08
  • 2021-12-26
  • 2022-12-23
相关资源
相似解决方案