Create a semi-transparent cursor from an image

后端 未结 4 1026
感情败类
感情败类 2021-02-14 23:20

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:02

    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

提交回复
热议问题