`
yuanlanxiaup
  • 浏览: 858463 次
文章分类
社区版块
存档分类
最新评论

C# Creating a Custom Mouse Cursor

 
阅读更多

C# Creating a Custom Mouse Cursor

Posted in Programming at 7:17 am by Michael Daniel

This is surprisingly easy to do. To create a cursor from an image resource:

Cursor cursor = new Cursor(Properties.Resources.add.GetHicon());
this.Cursor = cursor;

To create a cursor from any graphic:

Bitmap bmp = new Bitmap(55, 25);
Graphics g = Graphics.FromImage(bmp);
g.DrawString(“Hello World!”, this.Font, Brushes.Blue, 0, 0);
Cursor cursor = new Cursor(bmp.GetHicon());
this.Cursor = cursor;

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics