Esempio n. 1
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupRadioButtonText class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonRadioButton">Group radio button to display title for.</param>
        /// <param name="firstText">Should show the first button text.</param>
        public ViewDrawRibbonGroupRadioButtonText(KryptonRibbon ribbon,
                                                  KryptonRibbonGroupRadioButton ribbonRadioButton,
                                                  bool firstText)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonRadioButton != null);

            _ribbon            = ribbon;
            _ribbonRadioButton = ribbonRadioButton;
            _firstText         = firstText;

            // Use a class to convert from ribbon group to content interface
            _contentProvider = new RibbonGroupNormalDisabledTextToContent(ribbon.StateCommon.RibbonGeneral,
                                                                          ribbon.StateNormal.RibbonGroupRadioButtonText,
                                                                          ribbon.StateDisabled.RibbonGroupRadioButtonText);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupRadioButtonImage class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonRadioButton">Reference to ribbon group radio button definition.</param>
        /// <param name="large">Show the large image.</param>
        public ViewDrawRibbonGroupRadioButtonImage(KryptonRibbon ribbon,
                                                   KryptonRibbonGroupRadioButton ribbonRadioButton,
                                                   bool large)
        {
            Debug.Assert(ribbonRadioButton != null);

            // Remember incoming parameters
            _ribbonRadioButton = ribbonRadioButton;
            _large             = large;

            // Use redirector to get the radio button images and redirect to parent palette
            PaletteRedirectRadioButton redirectImages = new(ribbon.GetRedirector(), ribbon.StateCommon.RibbonImages.RadioButton);

            // Create drawing element
            _drawRadioButton = new ViewDrawRadioButton(redirectImages);

            // Add as only child
            Add(_drawRadioButton);
            _smallSize = new Size((int)(16 * FactorDpiX), (int)(16 * FactorDpiY));
            _largeSize = new Size((int)(32 * FactorDpiX), (int)(32 * FactorDpiY));
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes the designer with the specified component.
        /// </summary>
        /// <param name="component">The IComponent to associate the designer with.</param>
        public override void Initialize(IComponent component)
        {
            // Let base class do standard stuff
            base.Initialize(component);

            Debug.Assert(component != null);

            // Cast to correct type
            _ribbonRadioButton = component as KryptonRibbonGroupRadioButton;
            if (_ribbonRadioButton != null)
            {
                _ribbonRadioButton.DesignTimeContextMenu += OnContextMenu;
            }

            // Get access to the services
            _designerHost  = (IDesignerHost)GetService(typeof(IDesignerHost));
            _changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));

            // We need to know when we are being removed/changed
            _changeService.ComponentChanged += OnComponentChanged;
        }