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. Can I use gif images for some toolbar buttons?

Can I use gif images for some toolbar buttons?

Scheduled Pinned Locked Moved C / C++ / MFC
c++graphicsquestion
7 Posts 3 Posters 9 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.
  • D Offline
    D Offline
    danginkgo
    wrote on last edited by
    #1

    I use bitmaps for some toolbar buttons. Ex. In my .rc file I have: FLDWZOOM BITMAP MOVEABLE PURE "fldwzoom.bmp" I my .cpp file I load the bitmaps for the buttons case IDM_ZOOM:hBitmap=LoadBitmap((HINSTANCEhResource, "FLDWZOOM"); break; Can I load gif images instead of bitmaps? If I can, what function must I use?

    danginkgo

    I 1 Reply Last reply
    0
    • D danginkgo

      I use bitmaps for some toolbar buttons. Ex. In my .rc file I have: FLDWZOOM BITMAP MOVEABLE PURE "fldwzoom.bmp" I my .cpp file I load the bitmaps for the buttons case IDM_ZOOM:hBitmap=LoadBitmap((HINSTANCEhResource, "FLDWZOOM"); break; Can I load gif images instead of bitmaps? If I can, what function must I use?

      danginkgo

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

      It's going to take some work. You can use OldLoadPicture to load a gif, which will give you an IPicture object. But you'll still need to show it on a button. The windows BUTTON class only takes HBITMAPs, so you'd need to do some owner draw. Luckily there's a whole bunch of owner-draw-buttons of all sorts here on codeproject. Look under desktop development / button controls. Even if you don't use one exactly (which would be a shock), you can still get good ideas on how to do your button. Good luck, Iain.

      Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.

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

        It's going to take some work. You can use OldLoadPicture to load a gif, which will give you an IPicture object. But you'll still need to show it on a button. The windows BUTTON class only takes HBITMAPs, so you'd need to do some owner draw. Luckily there's a whole bunch of owner-draw-buttons of all sorts here on codeproject. Look under desktop development / button controls. Even if you don't use one exactly (which would be a shock), you can still get good ideas on how to do your button. Good luck, Iain.

        Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.

        D Offline
        D Offline
        danginkgo
        wrote on last edited by
        #3

        Thank you, but I still have a problem. I have the GIFs that I have to load for the buttons. The GIFs have transparent background. I must have transparent background images on my toolbar buttons. I can't obtain transparent background BMPs from those GIFs. I was hopping that I can use the GIFs. So, I can use only BMP and ICO for windows BUTTON class?

        danginkgo

        I N 2 Replies Last reply
        0
        • D danginkgo

          Thank you, but I still have a problem. I have the GIFs that I have to load for the buttons. The GIFs have transparent background. I must have transparent background images on my toolbar buttons. I can't obtain transparent background BMPs from those GIFs. I was hopping that I can use the GIFs. So, I can use only BMP and ICO for windows BUTTON class?

          danginkgo

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

          danginkgo wrote:

          Thank you, but I still have a problem.

          Luckily, I gave you a good answer - go have a proper read of the button section on codeproject. There you will find all sorts of owner-draw buttons. Using the normal button class without doing extra work? Tough.

          danginkgo wrote:

          So, I can use only BMP and ICO for windows BUTTON class?

          Exactly. Iain.

          Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.

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

            danginkgo wrote:

            Thank you, but I still have a problem.

            Luckily, I gave you a good answer - go have a proper read of the button section on codeproject. There you will find all sorts of owner-draw buttons. Using the normal button class without doing extra work? Tough.

            danginkgo wrote:

            So, I can use only BMP and ICO for windows BUTTON class?

            Exactly. Iain.

            Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.

            D Offline
            D Offline
            danginkgo
            wrote on last edited by
            #5

            OK, thanks

            danginkgo

            1 Reply Last reply
            0
            • D danginkgo

              Thank you, but I still have a problem. I have the GIFs that I have to load for the buttons. The GIFs have transparent background. I must have transparent background images on my toolbar buttons. I can't obtain transparent background BMPs from those GIFs. I was hopping that I can use the GIFs. So, I can use only BMP and ICO for windows BUTTON class?

              danginkgo

              N Offline
              N Offline
              Nibu babu thomas
              wrote on last edited by
              #6

              danginkgo wrote:

              I have the GIFs that I have to load for the buttons. The GIFs have transparent background. I must have transparent background images on my toolbar buttons.

              Just to follow up on what Iain said, here[^] is some sample code on OleLoadPicture.

              Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

              D 1 Reply Last reply
              0
              • N Nibu babu thomas

                danginkgo wrote:

                I have the GIFs that I have to load for the buttons. The GIFs have transparent background. I must have transparent background images on my toolbar buttons.

                Just to follow up on what Iain said, here[^] is some sample code on OleLoadPicture.

                Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

                D Offline
                D Offline
                danginkgo
                wrote on last edited by
                #7

                OK, thanks, I'll try:)

                danginkgo

                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