コード例 #1
0
        public override RibbonItem GetItemFromPoint(Point location)
        {
            RibbonControlGroupPanel targetPanel = null;

            foreach (var panel in this.Panels)
            {
                if (GetToolStripBounds(panel).Contains(location))
                {
                    targetPanel = panel;
                    break;
                }
            }
            if (targetPanel == null)
            {
                return(null);
            }

            foreach (var item in targetPanel.ControlItems)
            {
                if (targetPanel.GetItemBounds(item).Contains(location))
                {
                    return(item);
                }
            }
            return(null);
        }
コード例 #2
0
 public override void UpdateWithSizeDecided(Graphics g, RibbonThemaSettingsBase settings)
 {
     base.UpdateWithSizeDecided(g, settings);
     RibbonItemSize[] sizes = GetPanelSizesFromLevel(this.WidthLevel);
     for (int i = 0; i < this.Panels.Count; i++)
     {
         RibbonControlGroupPanel panel = this.Panels[i];
         panel.ItemSize = sizes[i];
         panel.UpdateWithSizeDecided(g, settings);
     }
 }
コード例 #3
0
        public Rectangle GetToolStripBounds(RibbonControlGroupPanel panel)
        {
            int       index       = this.Panels.IndexOf(panel);
            Rectangle groupBounds = this.Services.GetBounds(this);
            int       x           = groupBounds.Left + GroupBorder + (index + 1) * GroupPadding + this.Panels.Take(index).Select(p => p.UpdatedWidth).Sum();
            int       y           = groupBounds.Top + GroupBorder + GroupPadding;
            int       w           = panel.UpdatedWidth;
            int       h           = groupBounds.Height - HeaderHeight - GroupBorder - 2 * GroupPadding;

            return(new Rectangle(x, y, w, h));
        }