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 can I place an icon in an menu

How can I place an icon in an menu

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialhelpquestion
5 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.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    Hi, I want to add an icon left of the menutext in my menues. For example I have an icon in my toolbox and an equal text entry in my menu. So it would be nice if there is text and additionaly the icon of my toolbox in the menu. Unfortunately I have no idea how to place an icon in a menu. If anybody can help me, write an answer please. SuperRon

    S 1 Reply Last reply
    0
    • A Anonymous

      Hi, I want to add an icon left of the menutext in my menues. For example I have an icon in my toolbox and an equal text entry in my menu. So it would be nice if there is text and additionaly the icon of my toolbox in the menu. Unfortunately I have no idea how to place an icon in a menu. If anybody can help me, write an answer please. SuperRon

      S Offline
      S Offline
      Simon W 0
      wrote on last edited by
      #2

      change the menu items style to owner draw style,then draw it yourself. Check out the BCMenu code for detail. I am seeking... For what? Why did you ask me for what? I don't know!

      S 1 Reply Last reply
      0
      • S Simon W 0

        change the menu items style to owner draw style,then draw it yourself. Check out the BCMenu code for detail. I am seeking... For what? Why did you ask me for what? I don't know!

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

        Ok, but how can I change the menu items style? And how can I connect the icon with the menu item then? Where do can I find the BCMenu code? Please, help me again :omg:

        S 1 Reply Last reply
        0
        • S SuperRon2003

          Ok, but how can I change the menu items style? And how can I connect the icon with the menu item then? Where do can I find the BCMenu code? Please, help me again :omg:

          S Offline
          S Offline
          Simon W 0
          wrote on last edited by
          #4

          Get the menu handle or CMenu object(before the menu popup),use ModifyMenu to assign every menu item MF_OWNERDRAW style. And then your windows will be receive WM_MEASUREITEM and WM_DRAWITEM message,in the message handler you measure your menu item size and draw it as your wish. If you use MFC,it would be more easy. MFC will call your CMenu::MeasureItem and CMenu::DrawItem() automatically. BTW: you can find BCMenu in CP. I am seeking... For what? Why did you ask me for what? I don't know!

          S 1 Reply Last reply
          0
          • S Simon W 0

            Get the menu handle or CMenu object(before the menu popup),use ModifyMenu to assign every menu item MF_OWNERDRAW style. And then your windows will be receive WM_MEASUREITEM and WM_DRAWITEM message,in the message handler you measure your menu item size and draw it as your wish. If you use MFC,it would be more easy. MFC will call your CMenu::MeasureItem and CMenu::DrawItem() automatically. BTW: you can find BCMenu in CP. I am seeking... For what? Why did you ask me for what? I don't know!

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

            Thanks, I found BCMenu, and it works pretty nice.:-D

            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