creating a custom cursor

W

Wilfried Mestdagh

Hi,

I'm trying to create a custom cursor with following code:

Bitmap bmp = new Bitmap(@"c:\1.png");
Graphics g = Graphics.FromImage(bmp);
Cursor cursor = new Cursor(bmp.GetHicon());
this.Cursor = cursor;

But I get the exception: "A graphic object cannot be created with an
indexed pixel format." I drawed the thing in black/with using Paint. I'm
not sure I understand what the 'indexed pixel format' is, but something
to do with Paint or do I use wrong code ?
 
W

Wilfried Mestdagh

Hi,

I just tryed with an *.ico file. Seems to work nice now. Sorry be to
fast asking questions :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top