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 / C++ / MFC
  4. How do I generate a System::Drawing::Color array?

How do I generate a System::Drawing::Color array?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++graphicsdata-structureshelp
4 Posts 4 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.
  • M Offline
    M Offline
    Manfr3d
    wrote on last edited by
    #1

    Hi guys, I want to make an array that consists of system defined colors. I wrote the code System::Drawing::Color Color1[]={Color::Black, Color::Brown, Color::Red}; what delivered the error 'System::Drawing::Color' : a native array cannot contain this managed type Then I tried this version Color Color1[] = __gc new Color[]; and I got this error error C2440: 'initializing' : cannot convert from 'System::Drawing::Color ^' to 'System::Drawing::Color' Has anyone an idea how to make this work? Thanks and best wishes

    I S H 3 Replies Last reply
    0
    • M Manfr3d

      Hi guys, I want to make an array that consists of system defined colors. I wrote the code System::Drawing::Color Color1[]={Color::Black, Color::Brown, Color::Red}; what delivered the error 'System::Drawing::Color' : a native array cannot contain this managed type Then I tried this version Color Color1[] = __gc new Color[]; and I got this error error C2440: 'initializing' : cannot convert from 'System::Drawing::Color ^' to 'System::Drawing::Color' Has anyone an idea how to make this work? Thanks and best wishes

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      Going from the 'System::Drawing::Color ^' I would guess that you'd get more help in the Managed C++ / CLI forum than here. Certainly my help would be rubbish - I'm a MFC/Win32 fossil. Iain.

      Iain Clarke appearing in spite of being begged not to by CPallini.

      1 Reply Last reply
      0
      • M Manfr3d

        Hi guys, I want to make an array that consists of system defined colors. I wrote the code System::Drawing::Color Color1[]={Color::Black, Color::Brown, Color::Red}; what delivered the error 'System::Drawing::Color' : a native array cannot contain this managed type Then I tried this version Color Color1[] = __gc new Color[]; and I got this error error C2440: 'initializing' : cannot convert from 'System::Drawing::Color ^' to 'System::Drawing::Color' Has anyone an idea how to make this work? Thanks and best wishes

        S Offline
        S Offline
        ShilpiP
        wrote on last edited by
        #3

        Click here[^] May be it will help u .

        Yes U Can ...If U Can ,Dream it , U can do it ...ICAN

        1 Reply Last reply
        0
        • M Manfr3d

          Hi guys, I want to make an array that consists of system defined colors. I wrote the code System::Drawing::Color Color1[]={Color::Black, Color::Brown, Color::Red}; what delivered the error 'System::Drawing::Color' : a native array cannot contain this managed type Then I tried this version Color Color1[] = __gc new Color[]; and I got this error error C2440: 'initializing' : cannot convert from 'System::Drawing::Color ^' to 'System::Drawing::Color' Has anyone an idea how to make this work? Thanks and best wishes

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          Your choice for aks this question on this forum was wrong you must ask Managed C++/CLI[^]. :)

          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