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. .bmp and .ico MFC vc++

.bmp and .ico MFC vc++

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
11 Posts 5 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
    Member_14575556
    wrote on last edited by
    #1

    I wanted to add .ico and .bmp files in the bottom of the dialog right after static text (e.g.like this-> warning :) and help :) )respectively. I'm having difficulty achieving this. I would like to request some guidance with this. Thanks in advance.

    D L 2 Replies Last reply
    0
    • M Member_14575556

      I wanted to add .ico and .bmp files in the bottom of the dialog right after static text (e.g.like this-> warning :) and help :) )respectively. I'm having difficulty achieving this. I would like to request some guidance with this. Thanks in advance.

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

      Member 14575556 wrote:

      I'm having difficulty achieving this.

      Which part exactly? Adding an image control to a dialog resource? Reading an image into a CImage or CBitmap object? Rendering that object?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

      M 1 Reply Last reply
      0
      • D David Crow

        Member 14575556 wrote:

        I'm having difficulty achieving this.

        Which part exactly? Adding an image control to a dialog resource? Reading an image into a CImage or CBitmap object? Rendering that object?

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

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

        Yes adding icon in any place in the dialog. I wanted to put my custom icon in the left bottom corner of the dialog box. Any guidance will be very helpful thanks.

        D L 2 Replies Last reply
        0
        • M Member_14575556

          Yes adding icon in any place in the dialog. I wanted to put my custom icon in the left bottom corner of the dialog box. Any guidance will be very helpful thanks.

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

          Can you not just add the control to the dialog resource like you did all of the other controls?

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

          M 1 Reply Last reply
          0
          • M Member_14575556

            I wanted to add .ico and .bmp files in the bottom of the dialog right after static text (e.g.like this-> warning :) and help :) )respectively. I'm having difficulty achieving this. I would like to request some guidance with this. Thanks in advance.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            You just need to add the relevant resource to your dialog. Either by adding a manual resource statement like:

            ICON IDI_APPLICATION, IDC_STATIC, 7, 7, 20, 20

            , or via the Visual Studio resource editor. Perhaps if you explain clearly what the problem is we may be able to offer further suggestions.

            M 1 Reply Last reply
            0
            • M Member_14575556

              Yes adding icon in any place in the dialog. I wanted to put my custom icon in the left bottom corner of the dialog box. Any guidance will be very helpful thanks.

              L Offline
              L Offline
              leon de boer
              wrote on last edited by
              #6

              It's called the NON client area but sorry I don't use MFC enough to help. What I can tell you is on the windows API it's the WM_NCPAINT message you need to handle and you simply draw the image onto the Device Context it provides. The WM_NCPAINT message is sent to a window when its frame must be painted. The DC is funny it is the size of the whole frame window with a big hole in the middle you cant draw which is the normal client area. So you can draw from RECT.bottom up whatever the height of the frame is. WM_NCPAINT message - Windows applications | Microsoft Docs[^] You need to handle that however you do in MFC (the code snippett on the link shows how you get the DC on normal Win32 API).

              In vino veritas

              L V 2 Replies Last reply
              0
              • L leon de boer

                It's called the NON client area but sorry I don't use MFC enough to help. What I can tell you is on the windows API it's the WM_NCPAINT message you need to handle and you simply draw the image onto the Device Context it provides. The WM_NCPAINT message is sent to a window when its frame must be painted. The DC is funny it is the size of the whole frame window with a big hole in the middle you cant draw which is the normal client area. So you can draw from RECT.bottom up whatever the height of the frame is. WM_NCPAINT message - Windows applications | Microsoft Docs[^] You need to handle that however you do in MFC (the code snippett on the link shows how you get the DC on normal Win32 API).

                In vino veritas

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                I have already recommended that course to him more than once. And also explained why MFC is not the best vehicle when you want to change almost everything about the look of the GUI objects.

                1 Reply Last reply
                0
                • L leon de boer

                  It's called the NON client area but sorry I don't use MFC enough to help. What I can tell you is on the windows API it's the WM_NCPAINT message you need to handle and you simply draw the image onto the Device Context it provides. The WM_NCPAINT message is sent to a window when its frame must be painted. The DC is funny it is the size of the whole frame window with a big hole in the middle you cant draw which is the normal client area. So you can draw from RECT.bottom up whatever the height of the frame is. WM_NCPAINT message - Windows applications | Microsoft Docs[^] You need to handle that however you do in MFC (the code snippett on the link shows how you get the DC on normal Win32 API).

                  In vino veritas

                  V Offline
                  V Offline
                  Victor Nijegorodov
                  wrote on last edited by
                  #8

                  leon de boer wrote:

                  It's called the NON client area but sorry I don't use MFC enough to help.

                  Why is "the left bottom corner of the dialog box" called "NON client area"? :confused:

                  L 1 Reply Last reply
                  0
                  • D David Crow

                    Can you not just add the control to the dialog resource like you did all of the other controls?

                    "One man's wage rise is another man's price increase." - Harold Wilson

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                    M Offline
                    M Offline
                    Member_14575556
                    wrote on last edited by
                    #9

                    Thank you for the reply. I did that and achieved what I wanted. :)

                    1 Reply Last reply
                    0
                    • L Lost User

                      You just need to add the relevant resource to your dialog. Either by adding a manual resource statement like:

                      ICON IDI_APPLICATION, IDC_STATIC, 7, 7, 20, 20

                      , or via the Visual Studio resource editor. Perhaps if you explain clearly what the problem is we may be able to offer further suggestions.

                      M Offline
                      M Offline
                      Member_14575556
                      wrote on last edited by
                      #10

                      Thank you for the reply. After a lot of trial and error and following the guidance. I got what I wanted. :-D

                      1 Reply Last reply
                      0
                      • V Victor Nijegorodov

                        leon de boer wrote:

                        It's called the NON client area but sorry I don't use MFC enough to help.

                        Why is "the left bottom corner of the dialog box" called "NON client area"? :confused:

                        L Offline
                        L Offline
                        leon de boer
                        wrote on last edited by
                        #11

                        Thought he wanted to draw in the frame which is non client .. that belongs to windows (the O/S) not the app (the client). It's so easy to draw in the normal client screen area with MFC didn't think you could mess that up ... Anyhow he worked it out. Moral never over-estimate the question being asked :-)

                        In vino veritas

                        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