Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public static extern bool SetMenuItemInfo(HandleRef hMenu, int uItem, bool fByPosition, MENUITEMINFO_T_RW lpmii);
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
 public static extern bool SetMenuItemInfo(HandleRef hMenu, int uItem, bool fByPosition, MENUITEMINFO_T_RW lpmii);