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. [Win CE/Pocket PC]How to load an gif image on to a Button

[Win CE/Pocket PC]How to load an gif image on to a Button

Scheduled Pinned Locked Moved C / C++ / MFC
visual-studiojsonhelptutorialquestion
6 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.
  • M Offline
    M Offline
    madyastha
    wrote on last edited by
    #1

    Hi All, I am developing an application to Windows Mobile Using VS 2005. And the OS is Windows XP. I have developed a new dialpad with buttons. As a dialpad it works fine. But for this I need to load an image. Using CBitmapButton i can load only BMP images. This image changes according to the Skin of the mobile. When I googled I got the Answer as

    SetBitmap

    API. But to my badluck that is not available for CButton. Along with this, is it possible to write text on a loaded image? So can someone help regarding this. If it is Code then it will be more helpful. Thanks in advance.

    D 1 Reply Last reply
    0
    • M madyastha

      Hi All, I am developing an application to Windows Mobile Using VS 2005. And the OS is Windows XP. I have developed a new dialpad with buttons. As a dialpad it works fine. But for this I need to load an image. Using CBitmapButton i can load only BMP images. This image changes according to the Skin of the mobile. When I googled I got the Answer as

      SetBitmap

      API. But to my badluck that is not available for CButton. Along with this, is it possible to write text on a loaded image? So can someone help regarding this. If it is Code then it will be more helpful. Thanks in advance.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      madyastha wrote:

      When I googled I got the Answer as SetBitmap API. But to my badluck that is not available for CButton.

      See here.

      madyastha wrote:

      Along with this, is it possible to write text on a loaded image? So can someone help regarding this.

      Does this help?

      "Love people and use things, not love things and use people." - Unknown

      "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

      M 1 Reply Last reply
      0
      • D David Crow

        madyastha wrote:

        When I googled I got the Answer as SetBitmap API. But to my badluck that is not available for CButton.

        See here.

        madyastha wrote:

        Along with this, is it possible to write text on a loaded image? So can someone help regarding this.

        Does this help?

        "Love people and use things, not love things and use people." - Unknown

        "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

        M Offline
        M Offline
        madyastha
        wrote on last edited by
        #3

        Hello Thanks for quick response. Before posting here I have tried SetBitmap() or SendMessage() Functions. In the link you mentioned it is once again telling the same. Use SetBitmap(). So this wont solves my problem Thanks.

        D 1 Reply Last reply
        0
        • M madyastha

          Hello Thanks for quick response. Before posting here I have tried SetBitmap() or SendMessage() Functions. In the link you mentioned it is once again telling the same. Use SetBitmap(). So this wont solves my problem Thanks.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          I was simply responding to your "SetBitmap is not available for CButton" statement. Have you looked at the CImage class? It can handle other graphic formats in addition to BMP.

          "Love people and use things, not love things and use people." - Unknown

          "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

          M 1 Reply Last reply
          0
          • D David Crow

            I was simply responding to your "SetBitmap is not available for CButton" statement. Have you looked at the CImage class? It can handle other graphic formats in addition to BMP.

            "Love people and use things, not love things and use people." - Unknown

            "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

            M Offline
            M Offline
            madyastha
            wrote on last edited by
            #5

            Hi... Is this is correct way of using CImage & its functions? Because using this also I was not able to load image.

            HBITMAP hBitmap = NULL;
            hBitmap = SHLoadImageFile(TEXT("windows\\dlrbtn_up_land.gif")); //this returns a valid handle.

            CRect tr;
            m_btnSeven.GetClientRect(&tr);//Button on which i have to load image

            HDC hdc;
            hdc = ::GetDC(m_hWnd);//gets HDC.

            CImage cImage;
            cImage.Attach(hBitmap);//Attach the HBITMAP to CImage object

            cImage.Draw(hdc,tr);//Draw the image

            M 1 Reply Last reply
            0
            • M madyastha

              Hi... Is this is correct way of using CImage & its functions? Because using this also I was not able to load image.

              HBITMAP hBitmap = NULL;
              hBitmap = SHLoadImageFile(TEXT("windows\\dlrbtn_up_land.gif")); //this returns a valid handle.

              CRect tr;
              m_btnSeven.GetClientRect(&tr);//Button on which i have to load image

              HDC hdc;
              hdc = ::GetDC(m_hWnd);//gets HDC.

              CImage cImage;
              cImage.Attach(hBitmap);//Attach the HBITMAP to CImage object

              cImage.Draw(hdc,tr);//Draw the image

              M Offline
              M Offline
              madyastha
              wrote on last edited by
              #6

              Hello .... :( Pls can somebody help me regarding this. 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