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 add image buttons?

How to add image buttons?

Scheduled Pinned Locked Moved C / C++ / MFC
c++questiontutorial
7 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.
  • S Offline
    S Offline
    Shirani
    wrote on last edited by
    #1

    Hi i am quite new in MFC but know C++ programing and done work in VC 6 using win32 console application now switching to MFC. So please tell me how can i add images button? How can i change the colors of dialouge boxes. I shall be very thankfull to you.

    Regards: Xohaib Shirani

    H I 2 Replies Last reply
    0
    • S Shirani

      Hi i am quite new in MFC but know C++ programing and done work in VC 6 using win32 console application now switching to MFC. So please tell me how can i add images button? How can i change the colors of dialouge boxes. I shall be very thankfull to you.

      Regards: Xohaib Shirani

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

      CImage m; m.Load(_T("c:\\1.jpg")); m_Button.SetBitmap(m.detach()); but if you want to use of bitmaps you can use of LoadImage.

      S 1 Reply Last reply
      0
      • H Hamid Taebi

        CImage m; m.Load(_T("c:\\1.jpg")); m_Button.SetBitmap(m.detach()); but if you want to use of bitmaps you can use of LoadImage.

        S Offline
        S Offline
        Shirani
        wrote on last edited by
        #3

        Dear i tell you that i am quite new in MFC so plz guide me where i have to put this code CImage m; m.Load(_T("c:\\1.jpg")); m_Button.SetBitmap(m.detach()); ??

        Regards: Xohaib Shirani

        H 1 Reply Last reply
        0
        • S Shirani

          Dear i tell you that i am quite new in MFC so plz guide me where i have to put this code CImage m; m.Load(_T("c:\\1.jpg")); m_Button.SetBitmap(m.detach()); ??

          Regards: Xohaib Shirani

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

          So you need to more info,Ok. First you must load your image with LoadImage or CImage class or GDI+,... After load your image you will be have a handle to that image file then you can use of this handle at control that you want to use it. For example I guess you have a Static control and you want to insertimage to it: //(1)Declare a variable of CImage #include "atlImage.h" CImage m; //(2) load image file (you need to path of file m.Load(_T("c:\\1.jpg")); //(3) set control to that image file m_Static.SetBitmap(m.detach());

          S 1 Reply Last reply
          0
          • H Hamid Taebi

            So you need to more info,Ok. First you must load your image with LoadImage or CImage class or GDI+,... After load your image you will be have a handle to that image file then you can use of this handle at control that you want to use it. For example I guess you have a Static control and you want to insertimage to it: //(1)Declare a variable of CImage #include "atlImage.h" CImage m; //(2) load image file (you need to path of file m.Load(_T("c:\\1.jpg")); //(3) set control to that image file m_Static.SetBitmap(m.detach());

            S Offline
            S Offline
            Shirani
            wrote on last edited by
            #5

            Do you have any idea to change the colors of dialoge boxes?? I ask too much question?? Hmmm... Sory bro need to learn... :-D

            Regards: Xohaib Shirani

            H 1 Reply Last reply
            0
            • S Shirani

              Do you have any idea to change the colors of dialoge boxes?? I ask too much question?? Hmmm... Sory bro need to learn... :-D

              Regards: Xohaib Shirani

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

              Yeah I have an Idea WM_CTLCOLOR is your answer. ;)

              1 Reply Last reply
              0
              • S Shirani

                Hi i am quite new in MFC but know C++ programing and done work in VC 6 using win32 console application now switching to MFC. So please tell me how can i add images button? How can i change the colors of dialouge boxes. I shall be very thankfull to you.

                Regards: Xohaib Shirani

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

                Start by browsing this website. I know there are multiple articles on fancy buttons, and some on changing backgrounds for all sorts of things. Expand the "desktop development" part on the left, the look under "button controls", and "dialog and windows". It will take you a while to find what you are looking for, but you'll trip over many other good things along the way. Iain.

                Iain Clarke appears because CPallini still cares.

                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