Beispiel #1
0
        /// <summary>
        /// Refresh items
        /// </summary>
        private void RefreshItems()
        {
            Controls.Clear();
            Controls.Add(_sidePanel);

            if (Items.Count > 0)
            {
                Items[0].Selected = true;
            }

            // Adds menu items
            for (int i = 0; i < Items.Count; i++)
            {
                DrawerItem item = Items[i];
                item.Owner    = this;
                item.Location = new Point(_sidePanel.Width, i * 65);
                item.Tint     = this.Tint;
                Controls.Add(item);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Click on item
        /// </summary>
        public void ItemClick(DrawerItem clickedItem)
        {
            if (clickedItem != MenuItem)
            {
                // Refresh items click
                if (clickedItem != _selectedItem)
                {
                    for (int i = 0; i < Items.Count; i++)
                    {
                        DrawerItem item = Items[i];
                        item.Selected = false;
                        item.Invalidate();
                    }

                    _tSlider            = 0;
                    _tempSliderPosition = _sliderPosition;
                    _clickedItemPoint   = clickedItem.Location;
                    _selectedItem       = clickedItem;
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// On handle created
        /// </summary>
        /// <param name="e"></param>
        protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);

            // Menu item
            MenuItem             = new DrawerItem("");
            MenuItem.FullColored = true;
            MIcon icon = MIcon.Menu;

            icon.DarkBased  = true;
            MenuItem.Icon   = icon;
            MenuItem.Click += MenuClick;
            Items.Insert(0, MenuItem);
            MenuItem.TriggerResize();
            this.OnResize(EventArgs.Empty);
            RefreshItems();
            Invalidate(true);

            _clickedItemPoint.Y   = _selectedItem.Location.Y;
            _tempSliderPosition.Y = _selectedItem.Location.Y;
            _sliderPosition.Y     = _selectedItem.Location.Y;
        }