2

I want to achieve the Menu style same like Visual Studio with Images (see image below)VisualStudio Menu

I could insert items in Menu using CMFCToolBarMenuButton. But the problem is with Disable state. My Menu images are completely greyed out (see image below)

MyMenu

I want Menu Images to be displayed like "Redo, Undo Last Global Action" shown in Visual Studio Menu.

How can I do it?

latosvarun
  • 93
  • 6
  • For me, when I go to update the menu I determine if it is going to be disabled and at that point programmatically change the bitmap to greyscale. Then I use `SetMenuItemBitmaps`. But you have tagged it about the toolbar so I am not sure if context menus apply. – Andrew Truckle Jul 03 '23 at 12:29
  • Have you investigated: `CMFCToolBar::SetGrayDisabledButtons`. – Andrew Truckle Jul 03 '23 at 12:32
  • @AndrewTruckle Does CMFCToolBar::SetGrayDisabledButtons Help? Because I am using CMFCToolBarMenuButton class to insert Menu items. – latosvarun Jul 03 '23 at 13:49
  • 1
    I did give a link about that class on the other question https://stackoverflow.com/q/76540984/2287576 – Andrew Truckle Jul 03 '23 at 14:34
  • 1
    To my experience the bitmaps used for toolbars contain only the normal state image and the rest are dynamically created by MFC. Try creating a new test MFC application with a toolbar and check the initial toolbar bitmap. It contains no grayed images at all and there are no other bitmaps either. The background must be of some specific color for this to work properly, I think. So, try using the same image format and background as the original. The images are 16x15 by default (weird). – Constantine Georgiou Jul 03 '23 at 15:29
  • Did you see this discussion? https://www.codeproject.com/Questions/205114/disable-buttons-in-CMFCToolbar – Andrew Truckle Jul 03 '23 at 20:10
  • You need a menu handler (ON_COMMAND) for menu items to be automatically enabled. Or you can programmatically control enablement with a custom update handler (ON_UPDATE_COMMAND_UI). https://learn.microsoft.com/en-us/cpp/mfc/tn021-command-and-message-routing?view=msvc-170 – Ed Dore Jul 12 '23 at 14:20

0 Answers0