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. showing the preview of an image

showing the preview of an image

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
15 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.
  • H Hamid Taebi

    Where you want to show this preview on the main dialog or other dialog


    WhiteSky


    V Offline
    V Offline
    vijay_aroli
    wrote on last edited by
    #3

    WhiteSky wrote:

    Where you want to show this preview on the main dialog or other dialog

    on the same dialog.

    vijay.

    D H 2 Replies Last reply
    0
    • V vijay_aroli

      WhiteSky wrote:

      Where you want to show this preview on the main dialog or other dialog

      on the same dialog.

      vijay.

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

      So just add a static control, with the SS_BITMAP style, to your dialog's template.


      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

      "Judge not by the eye but by the heart." - Native American Proverb

      V 1 Reply Last reply
      0
      • V vijay_aroli

        WhiteSky wrote:

        Where you want to show this preview on the main dialog or other dialog

        on the same dialog.

        vijay.

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

        vijay7173 wrote:

        same dialog

        But I suggest use of foreign dialog instead same dialog you insert a CDialog to your project and show preview on that dialog if you use of this way you have more control for example you can move this window without any work or change size of show image on the dialog or insert controls to this dialog for control picture,anyway if you want to use this way on the codeproject is more articles for example search for 3dmax,you can find an article in this article you can see behavior like 3dmax window);)


        WhiteSky


        V 1 Reply Last reply
        0
        • H Hamid Taebi

          vijay7173 wrote:

          same dialog

          But I suggest use of foreign dialog instead same dialog you insert a CDialog to your project and show preview on that dialog if you use of this way you have more control for example you can move this window without any work or change size of show image on the dialog or insert controls to this dialog for control picture,anyway if you want to use this way on the codeproject is more articles for example search for 3dmax,you can find an article in this article you can see behavior like 3dmax window);)


          WhiteSky


          V Offline
          V Offline
          vijay_aroli
          wrote on last edited by
          #6

          no, i dont want to have much features for the preview. i just need to show a thumbnail preview of the image icon selected. i dont want to provide the scaling options either. how can i do it???

          vijay.

          H 2 Replies Last reply
          0
          • D David Crow

            So just add a static control, with the SS_BITMAP style, to your dialog's template.


            "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

            "Judge not by the eye but by the heart." - Native American Proverb

            V Offline
            V Offline
            vijay_aroli
            wrote on last edited by
            #7

            DavidCrow wrote:

            So just add a static control, with the SS_BITMAP style, to your dialog's template.

            well sir, i did the same. but the static control does not display the bitmap image that i specify. However, is able to display the system icons (like Question mark Icon, or an Information Icon):confused:. i really dont know what mistake i am doing. :doh:

            vijay.

            H D 2 Replies Last reply
            0
            • V vijay_aroli

              DavidCrow wrote:

              So just add a static control, with the SS_BITMAP style, to your dialog's template.

              well sir, i did the same. but the static control does not display the bitmap image that i specify. However, is able to display the system icons (like Question mark Icon, or an Information Icon):confused:. i really dont know what mistake i am doing. :doh:

              vijay.

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

              CStatic has a function SetBitmap(that needs to hbitmap) but before it set Type of preperty window to Bitmap


              WhiteSky


              1 Reply Last reply
              0
              • V vijay_aroli

                no, i dont want to have much features for the preview. i just need to show a thumbnail preview of the image icon selected. i dont want to provide the scaling options either. how can i do it???

                vijay.

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

                One good way is David Crow answer other way is use of WM_ERASEBKGND for show preview of image


                WhiteSky


                1 Reply Last reply
                0
                • V vijay_aroli

                  DavidCrow wrote:

                  So just add a static control, with the SS_BITMAP style, to your dialog's template.

                  well sir, i did the same. but the static control does not display the bitmap image that i specify. However, is able to display the system icons (like Question mark Icon, or an Information Icon):confused:. i really dont know what mistake i am doing. :doh:

                  vijay.

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

                  vijay7173 wrote:

                  i really dont know what mistake i am doing.

                  And without seeing a relevant code snippet, neither do we.


                  "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                  "Judge not by the eye but by the heart." - Native American Proverb

                  1 Reply Last reply
                  0
                  • V vijay_aroli

                    no, i dont want to have much features for the preview. i just need to show a thumbnail preview of the image icon selected. i dont want to provide the scaling options either. how can i do it???

                    vijay.

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

                    Not problem I think its easy for you but if you have problem and I can help you you can ask;)


                    WhiteSky


                    V 1 Reply Last reply
                    0
                    • H Hamid Taebi

                      Not problem I think its easy for you but if you have problem and I can help you you can ask;)


                      WhiteSky


                      V Offline
                      V Offline
                      vijay_aroli
                      wrote on last edited by
                      #12

                      still cant get it work. :( below is the sample code snippet that isnt working for me. CStatic m_ImagstBox[5]; m_ImagstBox[i].Create(_T("BMP"),WS_CHILD|WS_VISIBLE|SS_ICON|SS_CENTERIMAGE|SS_SUNKEN,CRect(l,50,r,100), this,1001+i); m_ImagstBox[i].SetIcon(::LoadIcon(NULL,MAKEINTRESOURCE(IDI_BMP))); in the above code, IDI_BMP is the id of the icon that i want to display. but i dont know why it is not working. if i specify something like IDI_INFORMATION, then it displays the information icon in the static control. i even tried the SetBitnap function, to display a bitmap instead of an icon. but could not get it work. below is the sample code that i had written. m_st[i].SetBitmap(::LoadBitmap(NULL,MAKEINTRESOURCE(IDB_BITMAP_HOME))); i am new to MFC and i am sure that i am doing a mistake some where in the code. can u please point out where i am doing the mistake?

                      vijay.

                      H 1 Reply Last reply
                      0
                      • V vijay_aroli

                        still cant get it work. :( below is the sample code snippet that isnt working for me. CStatic m_ImagstBox[5]; m_ImagstBox[i].Create(_T("BMP"),WS_CHILD|WS_VISIBLE|SS_ICON|SS_CENTERIMAGE|SS_SUNKEN,CRect(l,50,r,100), this,1001+i); m_ImagstBox[i].SetIcon(::LoadIcon(NULL,MAKEINTRESOURCE(IDI_BMP))); in the above code, IDI_BMP is the id of the icon that i want to display. but i dont know why it is not working. if i specify something like IDI_INFORMATION, then it displays the information icon in the static control. i even tried the SetBitnap function, to display a bitmap instead of an icon. but could not get it work. below is the sample code that i had written. m_st[i].SetBitmap(::LoadBitmap(NULL,MAKEINTRESOURCE(IDB_BITMAP_HOME))); i am new to MFC and i am sure that i am doing a mistake some where in the code. can u please point out where i am doing the mistake?

                        vijay.

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

                        You have two ways create CStatic on your code or insert Static control of ToolBox;). But your problem check this code

                        m_ImagstBox[0].SetIcon(::LoadIcon**(AfxGetApp()->m_hInstance**,MAKEINTRESOURCE(IDI_BMP)));

                        And same For SetBitmap


                        WhiteSky


                        V 1 Reply Last reply
                        0
                        • H Hamid Taebi

                          You have two ways create CStatic on your code or insert Static control of ToolBox;). But your problem check this code

                          m_ImagstBox[0].SetIcon(::LoadIcon**(AfxGetApp()->m_hInstance**,MAKEINTRESOURCE(IDI_BMP)));

                          And same For SetBitmap


                          WhiteSky


                          V Offline
                          V Offline
                          vijay_aroli
                          wrote on last edited by
                          #14

                          oh yes, now its working. I have now learnt something from that. thank u. :)

                          vijay.

                          H 1 Reply Last reply
                          0
                          • V vijay_aroli

                            oh yes, now its working. I have now learnt something from that. thank u. :)

                            vijay.

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

                            You're welcome;)


                            WhiteSky


                            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