本文介绍: 如何管理鼠标指针 – Windows Forms .NET | Microsoft Learn。2024年1月10日。

图片转换为鼠标光标代码如下:

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格式(支持透明) 

参考

如何管理鼠标指针 – Windows Forms .NET | Microsoft Learnicon-default.png?t=N7T8https://learn.microsoft.com/zh-cn/dotnet/desktop/winforms/input-mouse/how-to-manage-cursor-pointer?view=netdesktop-8.0

特此记录

anlog

2024年1月10日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注