コード例 #1
0
        /// <summary>
        /// Adds a group menu item.
        /// </summary>
        /// <param name="name">The name for the instance.</param>
        /// <param name="text">The text to show on the instance.</param>
        /// <returns>The group menu item.</returns>
        public MenuContainer AddGroup(string name, string text)
        {
            // create a sub menu that will be shown when this button is pressed, users can add items to this menu
            var menuVertical = new MenuBarVertical(name + "-Menu")
            {
                ConfigExpanded = false
            };

            // create the button
            var menuBarButton = new MenuItemButton(name + "-Button")
            {
                ConfigText = text,
                Tag        = menuVertical
            };

            menuBarButton.MouseClicked += this.OnMouseClicked;
            menuBarButton.AddControl(menuVertical);
            menuVertical.ParentButton = menuBarButton;

            // add that button to me
            this.AddControl(menuBarButton);
            this.MustRedraw = true;

            return(menuVertical);
        }
コード例 #2
0
ファイル: MenuContainer.cs プロジェクト: xxy1991/cozy
        /// <summary>
        /// Adds a group menu item.
        /// </summary>
        /// <param name="name">The name for the instance.</param>
        /// <param name="text">The text to show on the instance.</param>
        /// <returns>The group menu item.</returns>
        public MenuContainer AddGroup(string name, string text)
        {
            // create a sub menu that will be shown when this button is pressed, users can add items to this menu
            var menuVertical = new MenuBarVertical(name + "-Menu")
            {
                ConfigExpanded = false
            };

            // create the button
            var menuBarButton = new MenuItemButton(name + "-Button")
            {
                ConfigText = text, 
                Tag = menuVertical
            };
            menuBarButton.MouseClicked += this.OnMouseClicked;
            menuBarButton.AddControl(menuVertical);
            menuVertical.ParentButton = menuBarButton;

            // add that button to me
            this.AddControl(menuBarButton);
            this.MustRedraw = true;

            return menuVertical;
        }