コード例 #1
0
        void MenuItem_Popup(object sender, EventArgs e)
        {
            MENUITEMINFO_T_RW menuItemInfo = new MENUITEMINFO_T_RW();

            // get the menu items collection
            Menu.MenuItemCollection mi = sender.GetType() == typeof(ContextMenu) ? ((ContextMenu)sender).MenuItems : ((MenuItem)sender).MenuItems;

            // we have to track the menuPosition ourselves
            // because MenuItem.Index is only correct when
            // all the menu items are visible.
            int miOn = 0;

            for (int i = 0; i < mi.Count; i++)
            {
                if (mi[i].Visible)
                {
                    Properties p = ((Properties)properties[mi[i]]);

                    if (p != null)
                    {
                        menuItemInfo.hbmpItem = p.renderBmpHbitmap;

                        //refresh the menu item where ((Menu)sender).Handle is the parent handle
                        SetMenuItemInfo(new HandleRef(null, ((Menu)sender).Handle),
                                        miOn,
                                        true,
                                        menuItemInfo);
                    }

                    miOn++;
                }
            }
        }
コード例 #2
0
        private void MenuItem_Popup(object sender, EventArgs e)
        {
            MENUITEMINFO_T_RW lpmii = new MENUITEMINFO_T_RW();

            Menu.MenuItemCollection menuItemCollection = sender.GetType() == typeof(ContextMenu) ? ((Menu)sender).MenuItems : ((Menu)sender).MenuItems;
            int uItem = 0;

            for (int index = 0; index < menuItemCollection.Count; ++index)
            {
                if (menuItemCollection[index].Visible)
                {
                    Properties property = (Properties)this.properties[(object)menuItemCollection[index]];
                    if (property != null)
                    {
                        lpmii.hbmpItem = property.renderBmpHbitmap;
                        VistaMenu.SetMenuItemInfo(new HandleRef((object)null, ((Menu)sender).Handle), uItem, true, lpmii);
                    }
                    ++uItem;
                }
            }
        }
コード例 #3
0
ファイル: VistaMenu.cs プロジェクト: wumn290/processhacker-3
        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();

            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);
            }
        }
コード例 #4
0
 public static extern bool SetMenuItemInfo(
     HandleRef hMenu,
     int uItem,
     bool fByPosition,
     MENUITEMINFO_T_RW lpmii);
コード例 #5
0
ファイル: VistaMenu.cs プロジェクト: RoDaniel/featurehouse
        void MenuItem_Popup(object sender, EventArgs e)
        {
            IntPtr parentHandle = ((Menu)sender).Handle;

            List<MenuItem> mnuBitmapChildren = (List<MenuItem>)menuParents[parentHandle];

            MENUITEMINFO_T_RW menuItemInfo = new MENUITEMINFO_T_RW();

            foreach (MenuItem menuItem in mnuBitmapChildren)
            {

                menuItemInfo.hbmpItem = ((Properties)properties[menuItem]).renderBmpHbitmap;

                SetMenuItemInfo(new HandleRef(null, parentHandle),
                    (int)typeof(MenuItem).InvokeMember("MenuID", BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty, null, menuItem, null),
                    false,
                    menuItemInfo);
            }
        }
コード例 #6
0
ファイル: VistaMenu.cs プロジェクト: RoDaniel/featurehouse
 public static extern bool SetMenuItemInfo(HandleRef hMenu, int uItem, bool fByPosition, MENUITEMINFO_T_RW lpmii);