Je veux que le premier élément du menu contextuel d’une icône de bac soit en gras. Cela devrait être facile mais je ne trouve pas ma réponse nulle part. Quelqu’un peut-il s’il vous plaît me diriger dans la bonne direction? C’est le code que j’utilise pour afficher les éléments:
void MenuItemWin::CreateNative( LPMENUITEMINFO itemInfo, HMENU nativeParentMenu, bool registerNative) { ZeroMemory(itemInfo, sizeof(MENUITEMINFO)); itemInfo->cbSize = sizeof(MENUITEMINFO); itemInfo->wID = ++UIWin::nextItemId; itemInfo->dwItemData = (ULONG_PTR) this; itemInfo->fMask = MIIM_ID | MIIM_FTYPE | MIIM_DATA; HMENU nativeSubmenu = 0; if (this->IsSeparator()) { itemInfo->fType = MFT_SEPARATOR; } else { itemInfo->fMask = itemInfo->fMask | MIIM_STRING | MIIM_SUBMENU | MIIM_STATE; itemInfo->fType = MFT_STRING; itemInfo->fState = this->IsEnabled() ? MFS_ENABLED : MFS_DISABLED; itemInfo->dwTypeData = (LPWSTR) this->wideOldLabel.c_str(); AutoPtr wsubmenu = this->submenu.cast(); if (!wsubmenu.isNull()) nativeSubmenu = wsubmenu->CreateNative(registerNative); itemInfo->hSubMenu = nativeSubmenu; if (this->IsCheck()) { itemInfo->fState |= this->GetState() ? MFS_CHECKED : MFS_UNCHECKED; } else if (!this->iconPath.empty()) { HBITMAP bitmap = UIWin::LoadImageAsBitmap(iconPath, GetSystemMesortingcs(SM_CXSMICON), GetSystemMesortingcs(SM_CYSMICON)); if (bitmap) { itemInfo->fMask = itemInfo->fMask | MIIM_BITMAP; itemInfo->hbmpItem = bitmap; } else { std::ssortingng error = Win32Utils::QuickFormatMessage(GetLastError()); Logger::Get("UI.MenuItem")->Error("Could not load icon (%s): %s", iconPath.c_str(), error.c_str()); } } } if (registerNative) { NativeItemBits* bits = new NativeItemBits; bits->id = itemInfo->wID; bits->parentMenu = nativeParentMenu; bits->submenu = nativeSubmenu; this->nativeItems.push_back(bits); } }