Example #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MDrawer()
        {
            InitializeComponent();

            // Side panel
            _sidePanel          = new MBufferedPanel();
            _sidePanel.Width    = 5;
            _sidePanel.Location = new Point(this.Location.X, this.Location.Y);
            _sidePanel.Paint   += SidePanelPaint;
            this.Controls.Add(_sidePanel);

            // Default variables
            _controlTimer          = new Timer();
            _controlTimer.Interval = 1;
            _controlTimer.Tick    += new EventHandler(Update);
            _controlTimer.Start();
            _sliderPosition     = new Point();
            _collapsed          = true;
            _tempSliderPosition = new Point(0, 0);
            _clickedItemPoint   = new Point(0, 0);
            _tSlider            = 0;
            _tDrawerMenu        = 1;
            Items = new ObservableCollection <DrawerItem>();
            Items.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(ItemsChanged);
            Width = 65 + 5;
            Dock  = DockStyle.Left;

            // Refresh items
            RefreshItems();
        }
Example #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MScrollablePanel()
        {
            InitializeComponent();

            // Default variables
            _controlTimer          = new Timer();
            _controlTimer.Interval = 1;
            _controlTimer.Tick    += new EventHandler(Update);
            _controlTimer.Start();
            _panel                     = new MBufferedPanel();
            _panel.Dock                = DockStyle.Fill;
            _panel.AutoScroll          = true;
            _panel.Scroll             += new ScrollEventHandler(PanelScrollbarScroll);
            _panel.MouseWheel         += new MouseEventHandler(PanelWheelScroll);
            _panel.AutoScrollPosition  = new Point(0, 0);
            _verticalScrollbar         = new MScrollbarVertical();
            _verticalScrollbar.Dock    = DockStyle.Right;
            _verticalScrollbar.Scroll += new EventHandler(ScrollbarScroll);
            _usedTheme                 = null;

            // Adds panel and scrollbar
            Controls.Add(_panel);
            Controls.Add(_verticalScrollbar);

            // Redraw control
            Invalidate(true);
        }