ComponentFactory.Krypton.Ribbon.ViewDrawRibbonGroupTrackBar.ViewDrawRibbonGroupTrackBar C# (CSharp) Method

ViewDrawRibbonGroupTrackBar() public method

Initialize a new instance of the ViewDrawRibbonGroupTrackBar class.
public ViewDrawRibbonGroupTrackBar ( KryptonRibbon ribbon, KryptonRibbonGroupTrackBar ribbonTrackBar, NeedPaintHandler needPaint ) : System
ribbon KryptonRibbon Reference to owning ribbon control.
ribbonTrackBar KryptonRibbonGroupTrackBar Reference to source track bar.
needPaint NeedPaintHandler Delegate for notifying paint requests.
return System
        public ViewDrawRibbonGroupTrackBar(KryptonRibbon ribbon,
                                           KryptonRibbonGroupTrackBar ribbonTrackBar,
                                           NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonTrackBar != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon = ribbon;
            _ribbonTrackBar = ribbonTrackBar;
            _needPaint = needPaint;
            _currentSize = _ribbonTrackBar.ItemSizeCurrent;

            // Hook into the textbox events
            _ribbonTrackBar.MouseEnterControl += new EventHandler(OnMouseEnterControl);
            _ribbonTrackBar.MouseLeaveControl += new EventHandler(OnMouseLeaveControl);

            // Associate this view with the source component (required for design time selection)
            Component = _ribbonTrackBar;

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the textbox
                ContextClickController controller = new ContextClickController();
                controller.ContextClick += new MouseEventHandler(OnContextClick);
                MouseController = controller;
            }

            // Create controller needed for handling focus and key tip actions
             _controller = new TrackBarController(_ribbon, _ribbonTrackBar, this);
            SourceController = _controller;
            KeyController = _controller;

            // We need to rest visibility of the textbox for each layout cycle
            _ribbon.ViewRibbonManager.LayoutBefore += new EventHandler(OnLayoutAction);
            _ribbon.ViewRibbonManager.LayoutAfter += new EventHandler(OnLayoutAction);

            // Define back reference to view for the text box definition
            _ribbonTrackBar.TrackBarView = this;

            // Give paint delegate to textbox so its palette changes are redrawn
            _ribbonTrackBar.ViewPaintDelegate = needPaint;

            // Hook into changes in the ribbon custom definition
            _ribbonTrackBar.PropertyChanged += new PropertyChangedEventHandler(OnTextBoxPropertyChanged);
        }