
图片转换为鼠标光标代码如下:
private void Form1_Load(object sender, EventArgs e)
{
//button1.Cursor = System.Windows.Forms.Cursors.Hand;
Bitmap bmp = new Bitmap("780.jpg");
Cursor cursor = new Cursor(bmp.GetHicon());
button1.Cursor = cursor;
}
注意事项:图片尽量使用png格式(支持透明)
参考
特此记录
anlog
2024年1月10日
本文介绍了如何在WindowsForms应用程序中,使用C#将图片转换为鼠标光标,特别提到了使用Bitmap类处理780.jpg图片并设置Button1的Cursor属性,以及推荐使用PNG格式以支持透明效果。同时,文章参考了MicrosoftLearn文档进行教学。
https://learn.microsoft.com/zh-cn/dotnet/desktop/winforms/input-mouse/how-to-manage-cursor-pointer?view=netdesktop-8.0

2323

被折叠的 条评论
为什么被折叠?



