Пример #1
0
        /// <summary>
        /// Creates new instance of the class and initializes it with the parent RibbonStrip control.
        /// </summary>
        /// <param name="parent">Reference to parent MetroToolbar control</param>
        public MetroToolbarContainer(MetroToolbar parent)
        {
            _MetroToolbar = parent;

            // We contain other controls
            m_IsContainer = true;
            this.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;

            _MainItemsContainer = new ItemContainer();
            _MainItemsContainer.LayoutOrientation = eOrientation.Horizontal;
            _MainItemsContainer.GlobalItem = false;
            _MainItemsContainer.Displayed = true;
            _MainItemsContainer.ItemSpacing = 0;
            _MainItemsContainer.SetSystemContainer(true);
            _MainItemsContainer.ContainerControl = parent;
            _MainItemsContainer.DesignTimeVisible = false;
            _MainItemsContainer.Name = "_MainItemsContainer";
            this.SubItems.Add(_MainItemsContainer);

            _ExpandButton = new ButtonItem();
            _ExpandButton.Click += new EventHandler(ExpandButtonClick);
            _ExpandButton.ImagePaddingHorizontal = 12;
            _ExpandButton.ImagePaddingVertical = 10;
            _ExpandButton.Name = "sysMetroToolbarExpandButton";
            _ExpandButton.SetSystemItem(true);
            _ExpandButton.ContainerControl = parent;
            _ExpandButton.DesignTimeVisible = false;
            UpdateExpandButtonImage();
            this.SubItems.Add(_ExpandButton);

            _ExtraItemsContainer = new ItemContainer();
            _ExtraItemsContainer.LayoutOrientation = eOrientation.Horizontal;
            _ExtraItemsContainer.GlobalItem = false;
            _ExtraItemsContainer.Displayed = true;
            _ExtraItemsContainer.MultiLine = true;
            _ExtraItemsContainer.SetSystemContainer(true);
            _ExtraItemsContainer.ContainerControl = parent;
            _ExtraItemsContainer.DesignTimeVisible = false;
            _ExtraItemsContainer.Name = "_ExtraItemsContainer";
            this.SubItems.Add(_ExtraItemsContainer);
        }
Пример #2
0
 private void LoadByMetroToolbar(MetroToolbar bar)
 {
     foreach (BaseItem item in bar.Items)
         LoadByRibbonBar(item, GetMetroToolbarCategory(bar.Text));
     foreach (BaseItem item in bar.ExtraItems)
         LoadByRibbonBar(item, GetMetroToolbarCategory(bar.Text));
 }
Пример #3
0
 private void LoadByCategory(MetroToolbar toolbar)
 {
     foreach (BaseItem item in toolbar.Items)
         LoadByCategory(item);
     foreach (BaseItem item in toolbar.ExtraItems)
         LoadByCategory(item);
 }