Applying a Custom Cursor Fails

I use to be able to create a custom cursor using the following code

Dim c as mousecursor
littlecursor.ApplyMask cursormask
c = new mousecursor(littlecursor,7,7)

where cursormask and littlecursor are picture class objects

But the applymask routine fails and causes a crash with the error
applymask cannot be applied to immutable bitmaps

The mask is applied to make the parts of the cursor transparent.
Can someone provide help in creating/applying a custom cursor. Thank you.

You probably need to clone littlecursor into a new picture you create in code.

Try this:

dim lilcopy as new picture (littlecursor.width,littlecursor.height,32) littlecursor,0,0
lilcopy.ApplyMask cursormask
c = new mousecursor(lilcopy,7,7)

Thank you! That works.