void MenuItem_Popup(object sender, EventArgs e) { //get the parentHandle IntPtr parentHandle = ((Menu)sender).Handle; //get the list of children menuitems to "refresh" List <MenuItem> mnuBitmapChildren = (List <MenuItem>)menuParents[parentHandle]; MENUITEMINFO_T_RW menuItemInfo = new MENUITEMINFO_T_RW(); menuItemInfo.fMask = MIIM_BITMAP; foreach (MenuItem menuItem in mnuBitmapChildren) { //menuItem. menuItemInfo.hbmpItem = ((Properties)properties[menuItem]).renderBmpHbitmap; //refresh the menu item SetMenuItemInfo(new HandleRef(null, parentHandle), (int)typeof(MenuItem).InvokeMember("MenuID", BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty, null, menuItem, null), false, menuItemInfo); } }
public static extern bool SetMenuItemInfo(HandleRef hMenu, int uItem, bool fByPosition, MENUITEMINFO_T_RW lpmii);
void MenuItem_Popup(object sender, EventArgs e) { //get the parentHandle IntPtr parentHandle = ((Menu)sender).Handle; //get the list of children menuitems to "refresh" List<MenuItem> mnuBitmapChildren = (List<MenuItem>)menuParents[parentHandle]; MENUITEMINFO_T_RW menuItemInfo = new MENUITEMINFO_T_RW(); menuItemInfo.fMask = MIIM_BITMAP; foreach (MenuItem menuItem in mnuBitmapChildren) { //menuItem. menuItemInfo.hbmpItem = ((Properties)properties[menuItem]).renderBmpHbitmap; //refresh the menu item SetMenuItemInfo(new HandleRef(null, parentHandle), (int)typeof(MenuItem).InvokeMember("MenuID", BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty, null, menuItem, null), false, menuItemInfo); } }
public static extern bool SetMenuItemInfo(HandleRef hMenu, int uItem, bool fByPosition, MENUITEMINFO_T_RW lpmii);