Create a semi-transparent cursor from an image

后端 未结 4 2222
深忆病人
深忆病人 2021-02-14 23:12

Is it possible to create a cursor from an image and have it be semi-transparent?

I\'m currently taking a custom image and overylaying the mouse cursor image. It would b

4条回答
  •  隐瞒了意图╮
    2021-02-15 00:10

    that is very easy, I don't use API.

    the code is

      Bitmap img = new Bitmap(new Bitmap(@"image.png"), 30, 30); //this is the size of cursor
    
      Icon icono = Icon.FromHandle(img.GetHicon()); //create the Icon object 
    
      Cursor = new Cursor(icono.Handle); //the icon Object has the stream to create a Cursor.
    

    I hope that is your solution

提交回复
热议问题