1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| 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("lol.png"); SetCursor(a, new Point(0, 0)); }
|