Beispiel #1
0
        internal RibbonPanelPopup(RibbonPanel panel)
        {
            InitializeComponent();
            DoubleBuffered = true;

            _sensor            = new RibbonSensor(this, panel.Owner, panel.OwnerTab);
            _sensor.PanelLimit = panel;
            _panel             = panel;
            _panel.PopUp       = this;

            using (Graphics g = CreateGraphics())
            {
                Size s = panel.MeasureSize(this, new RibbonElementMeasureSizeEventArgs(g,
                                                                                       GetSizeMode(panel)));
                //s.Width+=3; s.Height+=3;
                Size = s;
                panel.SetBounds(new Rectangle(0, 0, Size.Width, Size.Height));
                panel.UpdateItemsRegions(g, GetSizeMode(panel));
            }

            foreach (RibbonItem item in panel.Items)
            {
                item.SetCanvas(this);
            }
        }
Beispiel #2
0
        internal RibbonDropDown(
            RibbonItem parentItem,
            IEnumerable <RibbonItem> items,
            Ribbon ownerRibbon,
            RibbonElementSizeMode measuringSize)
            : this()
        {
            _items            = items;
            _ownerRibbon      = ownerRibbon;
            _sizingGripHeight = 12;
            _parentItem       = parentItem;
            _sensor           = new RibbonSensor(this, OwnerRibbon, items);
            _MeasuringSize    = measuringSize;

            if (Items != null)
            {
                foreach (RibbonItem item in Items)
                {
                    item.SetSizeMode(RibbonElementSizeMode.DropDown);
                    item.SetCanvas(this);
                }
            }

            InitializeComponent();


            UpdateSize();
            UpdateItemsBounds();
        }