Load Cursor [modified] Wrong Code
-
Hello all. I created an Icon and embedded it in my Resource file. I've been able to get the cursor with the following:
using (MemoryStream resStream = new MemoryStream(SpatialLib.Properties.Resources.MapTipCur, false)) { this.MapControl.Cursor = new Cursor(resStream); }
Now, this successfully loads the cursor but there a huge problem...the cursor is all black. Not the original color. Has anyone gotten around this? Thanks in advance,Lester http://www.lestersconyers.com
modified on Monday, March 10, 2008 4:31 PM
-
Hello all. I created an Icon and embedded it in my Resource file. I've been able to get the cursor with the following:
using (MemoryStream resStream = new MemoryStream(SpatialLib.Properties.Resources.MapTipCur, false)) { this.MapControl.Cursor = new Cursor(resStream); }
Now, this successfully loads the cursor but there a huge problem...the cursor is all black. Not the original color. Has anyone gotten around this? Thanks in advance,Lester http://www.lestersconyers.com
modified on Monday, March 10, 2008 4:31 PM
If it's a black box, then it must not be loading correctly.
lsconyer wrote:
using (MemoryStream resStream = new MemoryStream(SpatialLib.Properties.Resources.MapTipCur, false)) { this.MapControl.Cursor = new Cursor(GetType(), "MapTipCur.cur"); }
I don't see how this would work, you never use the MemoryStream, so why create it ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
If it's a black box, then it must not be loading correctly.
lsconyer wrote:
using (MemoryStream resStream = new MemoryStream(SpatialLib.Properties.Resources.MapTipCur, false)) { this.MapControl.Cursor = new Cursor(GetType(), "MapTipCur.cur"); }
I don't see how this would work, you never use the MemoryStream, so why create it ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Sorry about that. I posted the wrong code sample. I just edited and changed the code. The cursor is not just a black box, though. It's the correct shape as my cursor but its just filled in black. I think it's a problem with the stream converting the byte[] into an image then to a cursor. I cannot get around it.
-
Sorry about that. I posted the wrong code sample. I just edited and changed the code. The cursor is not just a black box, though. It's the correct shape as my cursor but its just filled in black. I think it's a problem with the stream converting the byte[] into an image then to a cursor. I cannot get around it.
OK - there are two special colors in a cursor, are you using one of them ? Perhaps you've marked a transparent area, and that's what's failing to load properly ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )