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 to draw a bitmap from the memory.

How to draw a bitmap from the memory.

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsperformancetutorial
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.
  • P Offline
    P Offline
    paul_07
    wrote on last edited by
    #1

    I now can obtain a pointer points to the place where a bitmap stored in the memory, but I'm wandering how to display it on a dialogue based programme. Thank you for your attention. the simplier the better!

    R 1 Reply Last reply
    0
    • P paul_07

      I now can obtain a pointer points to the place where a bitmap stored in the memory, but I'm wandering how to display it on a dialogue based programme. Thank you for your attention. the simplier the better!

      R Offline
      R Offline
      rw104
      wrote on last edited by
      #2

      Select the bitmap into a new device context, (must be compatible, CreateCompatibleDC() does this); then just CDC->BitBlt(); on the OnPaint() proc of the dialog app

      P 1 Reply Last reply
      0
      • R rw104

        Select the bitmap into a new device context, (must be compatible, CreateCompatibleDC() does this); then just CDC->BitBlt(); on the OnPaint() proc of the dialog app

        P Offline
        P Offline
        paul_07
        wrote on last edited by
        #3

        rw104,thank you for your instructions, but I want to display the bitmap on a dialogue, so can you give me some more delights. the simplier the better!

        R 1 Reply Last reply
        0
        • P paul_07

          rw104,thank you for your instructions, but I want to display the bitmap on a dialogue, so can you give me some more delights. the simplier the better!

          R Offline
          R Offline
          rw104
          wrote on last edited by
          #4

          CDC imgDC;//temp CDC to render the bitmap into imgDC.CreateCompatibleDC(pdc); //pdc is the standard screen dialog CDC, imgDC needs to be compat.. CBitmap yourBitmap; yourBitmap.LoadBitmap(IDB_RESOURCEIMAGE); //IDB_RESOURCEIMAGE is an image resource //You already have a pointer to a bitmap so you do not need these two lines. imgDC.SelectObject(yourBitmap);//bitmap gets selected into the dc //bitblt the image , you 'll need to decide co-ordiantes pdc->BitBlt(0,0,100,100,&imgDC,0,0,SRCCOPY); That's it;P

          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