Loading embedded cursor through ResourceManager
-
I'm able to retrieve embedded resources like
Bitmap
s andString
s using the properties that Visual Studio 2005 adds to Resources.Designer.cs (or using the ResourceManager in that same file). But for some reason I have not succeeded in doing the same with aCursor
. Visual Studio only accepts a cursor as a file, thus giving me a byte array instead of aCursor
object. Of course I can do it the "old-fashioned" way, like this:System.Reflection.Assembly MyAssembly = System.Reflection.Assembly.GetExecutingAssembly(); Cursor MyCursor = new Cursor(MyAssembly.GetManifestResourceStream("MyProject.MyCursor.cur"));
But still, I would prefer it I could treat cursor the same other resource types. Am I missing something or is this simply an ommision on the part the Visual Studio crew? Speaking of cursors, why does C# only seems to support monochrome cursors? -
I'm able to retrieve embedded resources like
Bitmap
s andString
s using the properties that Visual Studio 2005 adds to Resources.Designer.cs (or using the ResourceManager in that same file). But for some reason I have not succeeded in doing the same with aCursor
. Visual Studio only accepts a cursor as a file, thus giving me a byte array instead of aCursor
object. Of course I can do it the "old-fashioned" way, like this:System.Reflection.Assembly MyAssembly = System.Reflection.Assembly.GetExecutingAssembly(); Cursor MyCursor = new Cursor(MyAssembly.GetManifestResourceStream("MyProject.MyCursor.cur"));
But still, I would prefer it I could treat cursor the same other resource types. Am I missing something or is this simply an ommision on the part the Visual Studio crew? Speaking of cursors, why does C# only seems to support monochrome cursors?jjansen wrote:
Speaking of cursors, why does C# only seems to support monochrome cursors?
Well the framework is simply dumb at this point. Its even mentioned in the documentation of the Cursor class that only not animated monochrome cursors are supported.
-
jjansen wrote:
Speaking of cursors, why does C# only seems to support monochrome cursors?
Well the framework is simply dumb at this point. Its even mentioned in the documentation of the Cursor class that only not animated monochrome cursors are supported.
-
I'm able to retrieve embedded resources like
Bitmap
s andString
s using the properties that Visual Studio 2005 adds to Resources.Designer.cs (or using the ResourceManager in that same file). But for some reason I have not succeeded in doing the same with aCursor
. Visual Studio only accepts a cursor as a file, thus giving me a byte array instead of aCursor
object. Of course I can do it the "old-fashioned" way, like this:System.Reflection.Assembly MyAssembly = System.Reflection.Assembly.GetExecutingAssembly(); Cursor MyCursor = new Cursor(MyAssembly.GetManifestResourceStream("MyProject.MyCursor.cur"));
But still, I would prefer it I could treat cursor the same other resource types. Am I missing something or is this simply an ommision on the part the Visual Studio crew? Speaking of cursors, why does C# only seems to support monochrome cursors?In my Embedded Image Grabber[^] tool, I managed to pull cursors out of embedded resources. I think that I did a byte-for-byte copy into a file and then loaded that, or something... The source code is available in the article. Josh
-
In my Embedded Image Grabber[^] tool, I managed to pull cursors out of embedded resources. I think that I did a byte-for-byte copy into a file and then loaded that, or something... The source code is available in the article. Josh
Josh Smith wrote:
In my Embedded Image Grabber[^] tool, I managed to pull cursors out of embedded resources.
It would appear you're using the same method as I currently am, ie. by getting a manifest resource stream from the assembly. Effective, but not as "fancy" as through the Resources property :).
-
Josh Smith wrote:
In my Embedded Image Grabber[^] tool, I managed to pull cursors out of embedded resources.
It would appear you're using the same method as I currently am, ie. by getting a manifest resource stream from the assembly. Effective, but not as "fancy" as through the Resources property :).
Oops...I guess I should have read your post more thoroughly. :-O