470,601 Members | 1,619 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,601 developers. It's quick & easy.

creating a custom cursor


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 ?

rgds, Wilfried [MapPoint MVP]
Jan 26 '07 #1
1 2840

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

rgds, Wilfried [MapPoint MVP]
Jan 26 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Simon Wigzell | last post: by
2 posts views Thread by Brad | last post: by
1 post views Thread by Tim | last post: by
reply views Thread by Andy Wynn | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.