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 use LoadBitmap in a dialog box

How to use LoadBitmap in a dialog box

Scheduled Pinned Locked Moved C / C++ / MFC
graphicstutoriallearning
23 Posts 4 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.
  • Y yaminisridaran

    I tried it in onintidialog it does not work. Can u suggest some more ways to solve this issue S.Yamini

    B Offline
    B Offline
    Bhavesh Bagadiya
    wrote on last edited by
    #13

    after onInitdialog completes, whole dialog being repainted so your graphics erased. one solution is to override OnEraseBkgnd and return TRUE from it so System will never erase background. but be careful, system never erase Background !!

    Y 1 Reply Last reply
    0
    • C chandu004

      how many images you have to the max.

      Y Offline
      Y Offline
      yaminisridaran
      wrote on last edited by
      #14

      I have two images.I has to toggle according to the mouse movement. I nned to know how to get the dc of the dialog control.Please S.Yamini

      C 1 Reply Last reply
      0
      • B Bhavesh Bagadiya

        after onInitdialog completes, whole dialog being repainted so your graphics erased. one solution is to override OnEraseBkgnd and return TRUE from it so System will never erase background. but be careful, system never erase Background !!

        Y Offline
        Y Offline
        yaminisridaran
        wrote on last edited by
        #15

        I cannot use erasebk bcoz i have to toggle the images. S.Yamini

        B 1 Reply Last reply
        0
        • Y yaminisridaran

          I cannot use erasebk bcoz i have to toggle the images. S.Yamini

          B Offline
          B Offline
          Bhavesh Bagadiya
          wrote on last edited by
          #16

          so whats problem will be in toggling images after overriding eraseBk ??? whatever painting done by you will be there, only system won't paint its default bkground ...

          Y 1 Reply Last reply
          0
          • C chandu004

            how many images you have to the max.

            C Offline
            C Offline
            chandu004
            wrote on last edited by
            #17

            are you using the bitmap control you have in your tool bar, or is it ok for you if i give my active X control which can take any bitmap image any time. what all you have to do is, you have to specify the file path. for example, ctrl.SetImage("C:\\image1.bmp"); then after some time, ctrl.SetImage("C:\\image2.bmp"); is it ok for u.

            1 Reply Last reply
            0
            • Y yaminisridaran

              I have two images.I has to toggle according to the mouse movement. I nned to know how to get the dc of the dialog control.Please S.Yamini

              C Offline
              C Offline
              chandu004
              wrote on last edited by
              #18

              assign a member variable to that control, then, m_ctrl.GetDC();

              1 Reply Last reply
              0
              • B Bhavesh Bagadiya

                so whats problem will be in toggling images after overriding eraseBk ??? whatever painting done by you will be there, only system won't paint its default bkground ...

                Y Offline
                Y Offline
                yaminisridaran
                wrote on last edited by
                #19

                Yes it will work. Can u suggest me for transparenting the background for the button control S.Yamini

                B 1 Reply Last reply
                0
                • Y yaminisridaran

                  Yes it will work. Can u suggest me for transparenting the background for the button control S.Yamini

                  B Offline
                  B Offline
                  Bhavesh Bagadiya
                  wrote on last edited by
                  #20

                  again, You can override OnEraceBk,, and return TRUE from there for that button, it won't paint buton background...

                  Y 1 Reply Last reply
                  0
                  • B Bhavesh Bagadiya

                    again, You can override OnEraceBk,, and return TRUE from there for that button, it won't paint buton background...

                    Y Offline
                    Y Offline
                    yaminisridaran
                    wrote on last edited by
                    #21

                    Thanks I will try S.Yamini

                    1 Reply Last reply
                    0
                    • Y yaminisridaran

                      I have to load a bitmap in a dialog box. I have loaded the Image in bitmap resource and then I tried the below code HBITMAP hBitmap=(HBITMAP)LoadBitmap(AfxGetInstanceHandle,"IDB_IMAGE"); but when i execute this statement the hBitmap is 0x0000000. Can anyone give me some suggestions. Is there any way to transparent the background of a button S.Yamini

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

                      If you have bmp on the resource you can use of CBitmap class.

                      Y 1 Reply Last reply
                      0
                      • H Hamid Taebi

                        If you have bmp on the resource you can use of CBitmap class.

                        Y Offline
                        Y Offline
                        yaminisridaran
                        wrote on last edited by
                        #23

                        Thanks. Is there any calculation to convert the x,y coordinate of the CPoint to angle of the circle S.Yamini

                        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