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. insert bitmap on SDI

insert bitmap on SDI

Scheduled Pinned Locked Moved C / C++ / MFC
graphicstutorial
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.
  • A Offline
    A Offline
    Amin Abdi
    wrote on last edited by
    #1

    hello everyone i want to load a bitmap from file and insert in specific coordinate of my SDI program. but when i write codes and run program it shows nothing. ;P could i have a guide to using and inserting bitmap in my SDI. thanx

    H 1 Reply Last reply
    0
    • A Amin Abdi

      hello everyone i want to load a bitmap from file and insert in specific coordinate of my SDI program. but when i write codes and run program it shows nothing. ;P could i have a guide to using and inserting bitmap in my SDI. thanx

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

      could you show your code?

      Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

      A 1 Reply Last reply
      0
      • H Hamid Taebi

        could you show your code?

        Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

        A Offline
        A Offline
        Amin Abdi
        wrote on last edited by
        #3

        CBitmap Bitmap;
        CDC dcMem;
        HBITMAP hBitmap = 0;
        hBitmap = (HBITMAP)LoadImage( AfxGetInstanceHandle(),
        strLocationOfBitmap,
        IMAGE_BITMAP,
        0,
        0,
        LR_LOADFROMFILE | LR_DEFAULTSIZE);

        dcMem.CreateCompatibleDC(pDC);
        Bitmap.CreateCompatibleBitmap(pDC, 390, -230);
        
        Bitmap.Attach( hBitmap );
        dcMem.SelectObject(&Bitmap);
        pDC->BitBlt(1280, -1765, 390,  -230, &dcMem, 0, 0, SRCCOPY);/\*pDC : on draw defined dc\*/
        

        i used many codes delete and add some function to them. i never used GUI in VC++. :(

        I 1 Reply Last reply
        0
        • A Amin Abdi

          CBitmap Bitmap;
          CDC dcMem;
          HBITMAP hBitmap = 0;
          hBitmap = (HBITMAP)LoadImage( AfxGetInstanceHandle(),
          strLocationOfBitmap,
          IMAGE_BITMAP,
          0,
          0,
          LR_LOADFROMFILE | LR_DEFAULTSIZE);

          dcMem.CreateCompatibleDC(pDC);
          Bitmap.CreateCompatibleBitmap(pDC, 390, -230);
          
          Bitmap.Attach( hBitmap );
          dcMem.SelectObject(&Bitmap);
          pDC->BitBlt(1280, -1765, 390,  -230, &dcMem, 0, 0, SRCCOPY);/\*pDC : on draw defined dc\*/
          

          i used many codes delete and add some function to them. i never used GUI in VC++. :(

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

          And where is this code? 1/ It would make sense to only load the CBitmap once - in your constructor maybe? 2/ -1765 seems very high... Does it work with (0,0) ? Iain.

          I have now moved to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[^]

          A 1 Reply Last reply
          0
          • I Iain Clarke Warrior Programmer

            And where is this code? 1/ It would make sense to only load the CBitmap once - in your constructor maybe? 2/ -1765 seems very high... Does it work with (0,0) ? Iain.

            I have now moved to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[^]

            A Offline
            A Offline
            Amin Abdi
            wrote on last edited by
            #5

            1. in a function within c..view class 2. no it doesn't work even at (0, 0)

            H 1 Reply Last reply
            0
            • A Amin Abdi

              1. in a function within c..view class 2. no it doesn't work even at (0, 0)

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

              Which event you use this code?

              Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

              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