I am creating a CMenu in Visual Studio 2010, MFC. I have a working CMenu that appears when a user right-clicks on a dialog. I can't seem to find a way to create menu selection without a spot for a checkbox. In Visual Studio's designer, my menu looks like this:
I wish to remove the area for a checkmark. In my application, my menu looks like this:
Is there a way to remove this small box, left of "Change Option"?
Update: Not sure this will help, but this is my code to create the CMenu:
CMenu menu;
VERIFY(menu.LoadMenu(IDR_MENU1));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
CWnd* pWndPopupOwner = this;
while (pWndPopupOwner->GetStyle() & WS_CHILD)
pWndPopupOwner = pWndPopupOwner->GetParent();
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, screenPoint.x, screenPoint.y,
pWndPopupOwner);
You will have to use an owner-draw menu for this. Popup menus always (by default) have space allocated for checkmark bitmaps. Going owner-draw will allow you to use CMenu::MeasureItem()
and CMenu::DrawItem()
to customize the size and drawing behavior of the menu object to your needs.