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

ViewDrawRibbonGroupComboBox() public method

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

            // Remember incoming references
            _ribbon = ribbon;
            _ribbonComboBox = ribbonComboBox;
            _needPaint = needPaint;
            _currentSize = _ribbonComboBox.ItemSizeCurrent;

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

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

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

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

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

            // Define back reference to view for the combo box definition
            _ribbonComboBox.ComboBoxView = this;

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

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