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. Menu with images

Menu with images

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++help
9 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.
  • A Offline
    A Offline
    Alex Cutovoi
    wrote on last edited by
    #1

    Hi fellows I need to insert an image in my menu. My menu is composed with the following strings: "New Text", "New File", "New Ruler". My menu was coded with win32, not MFC. Now the questions: 1) I've readed that I need to create owner draw menus. Is that right? 2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed. 3) What you recommend that I read to get a better understand of this topic and start coding? Any help is very welcomed. Again thanks for the support.

    H H M 3 Replies Last reply
    0
    • A Alex Cutovoi

      Hi fellows I need to insert an image in my menu. My menu is composed with the following strings: "New Text", "New File", "New Ruler". My menu was coded with win32, not MFC. Now the questions: 1) I've readed that I need to create owner draw menus. Is that right? 2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed. 3) What you recommend that I read to get a better understand of this topic and start coding? Any help is very welcomed. Again thanks for the support.

      H Offline
      H Offline
      Hans Dietrich
      wrote on last edited by
      #2

      I've used NewMenu in several projects. Excellent.

      Best wishes, Hans


      [CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]

      1 Reply Last reply
      0
      • A Alex Cutovoi

        Hi fellows I need to insert an image in my menu. My menu is composed with the following strings: "New Text", "New File", "New Ruler". My menu was coded with win32, not MFC. Now the questions: 1) I've readed that I need to create owner draw menus. Is that right? 2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed. 3) What you recommend that I read to get a better understand of this topic and start coding? Any help is very welcomed. Again thanks for the support.

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

        See Simple Bitmapped Menus[^] and http://www.codeguru.com/cpp/controls/menu/bitmappedmenus/article.php/c187/[^] for Vertical bitmap ;)


        WhiteSky


        A 1 Reply Last reply
        0
        • H Hamid Taebi

          See Simple Bitmapped Menus[^] and http://www.codeguru.com/cpp/controls/menu/bitmappedmenus/article.php/c187/[^] for Vertical bitmap ;)


          WhiteSky


          A Offline
          A Offline
          Alex Cutovoi
          wrote on last edited by
          #4

          thanks man, I'll see right now...

          H 1 Reply Last reply
          0
          • A Alex Cutovoi

            thanks man, I'll see right now...

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

            I hope it solved your problem.:)


            WhiteSky


            A 1 Reply Last reply
            0
            • A Alex Cutovoi

              Hi fellows I need to insert an image in my menu. My menu is composed with the following strings: "New Text", "New File", "New Ruler". My menu was coded with win32, not MFC. Now the questions: 1) I've readed that I need to create owner draw menus. Is that right? 2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed. 3) What you recommend that I read to get a better understand of this topic and start coding? Any help is very welcomed. Again thanks for the support.

              M Offline
              M Offline
              Manoj Kumar Rai
              wrote on last edited by
              #6

              Hi Alex, Since you have asked specifically for win32, I thought I should let you know the precisely steps to create Menu and answer your questions. 1) I've readed that I need to create owner draw menus. Is that right? Its not mandatory. 2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed. Windos fits the image accordingly. If you want text with a bmp as a menu item then again the space will be fixed for the bmp. Steps: HMENU Menu; Menu = CreatePopupMenu(); HBITMAP hBitmap1 = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1)); HBITMAP hBitmap2 = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP2)); //Append AppendMenu(Menu, MF_STRING, 2000, "Test3333333333"); AppendMenu(Menu, MF_SEPARATOR, NULL, ""); AppendMenu(Menu, MF_STRING, 2001, "Test2"); SetMenuItemBitmaps(Menu, 2001, MF_BYCOMMAND,hBitmap2, hBitmap1); TrackPopupMenu(Menu,TPM_RIGHTALIGN,point.x, point.y,0,this->m_hWnd,NULL); The above steps will create 2 Menu items, one only text and other bmp with text.

              Manoj Never Gives up

              A 1 Reply Last reply
              0
              • H Hamid Taebi

                I hope it solved your problem.:)


                WhiteSky


                A Offline
                A Offline
                Alex Cutovoi
                wrote on last edited by
                #7

                Thanks man, for your help

                H 1 Reply Last reply
                0
                • M Manoj Kumar Rai

                  Hi Alex, Since you have asked specifically for win32, I thought I should let you know the precisely steps to create Menu and answer your questions. 1) I've readed that I need to create owner draw menus. Is that right? Its not mandatory. 2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed. Windos fits the image accordingly. If you want text with a bmp as a menu item then again the space will be fixed for the bmp. Steps: HMENU Menu; Menu = CreatePopupMenu(); HBITMAP hBitmap1 = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1)); HBITMAP hBitmap2 = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP2)); //Append AppendMenu(Menu, MF_STRING, 2000, "Test3333333333"); AppendMenu(Menu, MF_SEPARATOR, NULL, ""); AppendMenu(Menu, MF_STRING, 2001, "Test2"); SetMenuItemBitmaps(Menu, 2001, MF_BYCOMMAND,hBitmap2, hBitmap1); TrackPopupMenu(Menu,TPM_RIGHTALIGN,point.x, point.y,0,this->m_hWnd,NULL); The above steps will create 2 Menu items, one only text and other bmp with text.

                  Manoj Never Gives up

                  A Offline
                  A Offline
                  Alex Cutovoi
                  wrote on last edited by
                  #8

                  Thanks for your help manoj, very thanks.... And thanks for the code, I'll test it right now

                  1 Reply Last reply
                  0
                  • A Alex Cutovoi

                    Thanks man, for your help

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

                    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