Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Loading embedded cursor through ResourceManager

Loading embedded cursor through ResourceManager

Scheduled Pinned Locked Moved C#
csharpquestionlearningvisual-studiographics
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jjansen
    wrote on last edited by
    #1

    I'm able to retrieve embedded resources like Bitmaps and Strings 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 a Cursor. Visual Studio only accepts a cursor as a file, thus giving me a byte array instead of a Cursor 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?

    R J 2 Replies Last reply
    0
    • J jjansen

      I'm able to retrieve embedded resources like Bitmaps and Strings 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 a Cursor. Visual Studio only accepts a cursor as a file, thus giving me a byte array instead of a Cursor 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?

      R Offline
      R Offline
      Robert Rohde
      wrote on last edited by
      #2

      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.

      J 1 Reply Last reply
      0
      • R Robert Rohde

        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.

        J Offline
        J Offline
        jjansen
        wrote on last edited by
        #3

        I had hoped C# 2.0 would have corrected this shortcoming. I really miss that colourful swimming jellyfish from Windows95 :laugh:

        1 Reply Last reply
        0
        • J jjansen

          I'm able to retrieve embedded resources like Bitmaps and Strings 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 a Cursor. Visual Studio only accepts a cursor as a file, thus giving me a byte array instead of a Cursor 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?

          J Offline
          J Offline
          Josh Smith
          wrote on last edited by
          #4

          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

          J 1 Reply Last reply
          0
          • J Josh Smith

            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

            J Offline
            J Offline
            jjansen
            wrote on last edited by
            #5

            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 :).

            J 1 Reply Last reply
            0
            • J jjansen

              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 :).

              J Offline
              J Offline
              Josh Smith
              wrote on last edited by
              #6

              Oops...I guess I should have read your post more thoroughly. :-O

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups