Using custom cursors for drag'n'drop - any limitations ?

alex19063
03-14-2006, 09:22 PM
I want to load my own cursor when performing a drag-drop operation. Are there any specific sizes and bit-depths I need to adhere to ?

I just now tried a 32x32 with 256 colors and the cursor shows as all black when I do the dragging.

jo0ls
03-15-2006, 06:12 AM
"The Cursor class does not support animated cursors (.ani files) or cursors with colors other than black and white."

Yet you can create color cursors from a bitmaps handle (though without a hotspot), loading some color cur files works, and loading other color cur files doesn't work.

dr.gui link (msdn) (http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnaraskdr/html/askgui11182003.asp)

jo0ls
03-15-2006, 07:38 AM
Here's an example of making a cursor from any image file.

As .Net will always put the cursor hotspot in the center of a cursor created like this, we need to pad with invisible space (depending on the location of the hotspot of course). So if we want the hotspot up at the top left of the cursor image. We create a new huge image, with padding along the top and left, so that the desired hotspot happens to be in the center of the new image.

You can create a cursor like this, and save the bitmap (as png, to keep the alpha channel). In another project, you then load the bitmap, and create a cursor from the bitmaps.HIcon.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum