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. Load Cursor [modified] Wrong Code

Load Cursor [modified] Wrong Code

Scheduled Pinned Locked Moved C#
comhardwarehelpquestionlearning
4 Posts 2 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.
  • L Offline
    L Offline
    lsconyer
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • L lsconyer

      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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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 )

      L 1 Reply Last reply
      0
      • C Christian Graus

        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 )

        L Offline
        L Offline
        lsconyer
        wrote on last edited by
        #3

        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.

        Lester http://www.lestersconyers.com

        C 1 Reply Last reply
        0
        • L lsconyer

          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.

          Lester http://www.lestersconyers.com

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          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 )

          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