public void SetCursor(Bitmap cursor, Point hotPoint)
{
int hotX = hotPoint.X;
int hotY = hotPoint.Y;
Bitmap myNewCursor = new Bitmap(cursor.Width * - hotX, cursor.Height * - hotY);
Graphics g = Graphics.FromImage(myNewCursor);
g.Clear(Color.FromArgb(, , , ));
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(, ));
}
----来自凌波小屋的笔记