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. Problem:Need to show an image depending on the options selected.

Problem:Need to show an image depending on the options selected.

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
3 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.
  • V Offline
    V Offline
    Victor Nikol
    wrote on last edited by
    #1

    I want to open a window,that will have a text field,several "combo box" with some options,a "Ok" button, and another field where I want to show an image(initially empty). After selecting the desired options and pressing the "Ok" button,I want to show an image. The image shown will deppend on the options. Can you tell me please how can I do this? (*Clarification*: The image is not an image on the disk,but something that will be generated from the options selected)

    D 1 Reply Last reply
    0
    • V Victor Nikol

      I want to open a window,that will have a text field,several "combo box" with some options,a "Ok" button, and another field where I want to show an image(initially empty). After selecting the desired options and pressing the "Ok" button,I want to show an image. The image shown will deppend on the options. Can you tell me please how can I do this? (*Clarification*: The image is not an image on the disk,but something that will be generated from the options selected)

      D Offline
      D Offline
      Dimenser
      wrote on last edited by
      #2

      Make the image a bitmap, assign it a name, like IDC_IMAGE. In the class wizard, go to member variables and Add Variable, and make it a control called m_image. Then import or create the bitmaps you want. In the Init Dialog section after it says, add extra initilization here, put VERIFY(picture1.LoadBitmap(IDB_MYPICTURE1)); VERIFY(picture2.LoadBitmap(IDB_MYPICTURE2)); Create two variables of CBitmap type and name them picture1 and picture 2. Then, in the part where you make your choice, if (buttonpressed==1) m_image.SetBitmap(picture1); if (buttonpressed==2) m_image.SetBitmap(picture2); I don't think I left anything out, and this works for me in visual c++ 6. Dimenser

      V 1 Reply Last reply
      0
      • D Dimenser

        Make the image a bitmap, assign it a name, like IDC_IMAGE. In the class wizard, go to member variables and Add Variable, and make it a control called m_image. Then import or create the bitmaps you want. In the Init Dialog section after it says, add extra initilization here, put VERIFY(picture1.LoadBitmap(IDB_MYPICTURE1)); VERIFY(picture2.LoadBitmap(IDB_MYPICTURE2)); Create two variables of CBitmap type and name them picture1 and picture 2. Then, in the part where you make your choice, if (buttonpressed==1) m_image.SetBitmap(picture1); if (buttonpressed==2) m_image.SetBitmap(picture2); I don't think I left anything out, and this works for me in visual c++ 6. Dimenser

        V Offline
        V Offline
        Victor Nikol
        wrote on last edited by
        #3

        I have something like this: CDC* my_DC; my_DC = new CDC; my_DC -> CreateCompatibleDC(NULL); my_DC -> PatBlt(0,0,my_size,my_size,WHITENESS); for (int i = 0; i < my_size; ++i ) for (int j = 0; j < my_size; ++j ) if (result[i][j]) my_DC->SetPixel( i, j, RGB(0, 0, 0)); How can I make a Bitmap from that? Thanks!

        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