/// <param name="ownerGroup">Group that this collection belongs to</param>
 internal RibbonItemGroupItemCollection(RibbonItemGroup ownerGroup)
 {
     _ownerGroup = ownerGroup;
 }
        /// <summary>
        /// Draws the background of the specified  RibbonItemGroup
        /// </summary>
        /// <param name="e"></param>
        /// <param name="?"></param>
        public void DrawItemGroupBorder(RibbonItemRenderEventArgs e, RibbonItemGroup grp)
        {
            Rectangle outerR = Rectangle.FromLTRB(
                grp.Bounds.Left,
                grp.Bounds.Top,
                grp.Bounds.Right - 1,
                grp.Bounds.Bottom - 1);

            Rectangle innerR = Rectangle.FromLTRB(
                outerR.Left + 1,
                outerR.Top + 1,
                outerR.Right - 1,
                outerR.Bottom - 1);

            GraphicsPath outer = RoundRectangle(outerR, 2);
            GraphicsPath inner = RoundRectangle(innerR, 2);

            using (Pen dark = new Pen(ColorTable.ItemGroupSeparatorDark))
            {
                using (Pen light = new Pen(ColorTable.ItemGroupSeparatorLight))
                {
                    foreach (RibbonItem item in grp.Items)
                    {
                        if (item == grp.LastItem) break;

                        e.Graphics.DrawLine(dark,
                            new Point(item.Bounds.Right, item.Bounds.Top),
                            new Point(item.Bounds.Right, item.Bounds.Bottom));

                        e.Graphics.DrawLine(light,
                            new Point(item.Bounds.Right + 1, item.Bounds.Top),
                            new Point(item.Bounds.Right + 1, item.Bounds.Bottom));
                    }
                }
            }

            using (Pen p = new Pen(ColorTable.ItemGroupOuterBorder))
            {
                e.Graphics.DrawPath(p, outer);
            }

            using (Pen p = new Pen(ColorTable.ItemGroupInnerBorder))
            {
                e.Graphics.DrawPath(p, inner);
            }

            outer.Dispose();
            inner.Dispose();
        }
예제 #3
0
 /// <summary>
 /// Sets the value of the OwnerList property
 /// </summary>
 /// <param name="ownerList"></param>
 internal virtual void SetOwnerGroup(RibbonItemGroup ownerGroup)
 {
     _ownerItem = ownerGroup;
 }
        /// <summary>
        /// Draws the background of the specified  RibbonItemGroup
        /// </summary>
        /// <param name="e"></param>
        /// <param name="?"></param>
        public void DrawItemGroup(RibbonItemRenderEventArgs e, RibbonItemGroup grp)
        {
            Rectangle outerR = Rectangle.FromLTRB(
                grp.Bounds.Left,
                grp.Bounds.Top,
                grp.Bounds.Right - 1,
                grp.Bounds.Bottom - 1);

            Rectangle innerR = Rectangle.FromLTRB(
                outerR.Left + 1,
                outerR.Top + 1,
                outerR.Right - 1,
                outerR.Bottom - 1);

            Rectangle glossyR = Rectangle.FromLTRB(
                outerR.Left + 1,
                outerR.Top + outerR.Height / 2 + 1,
                outerR.Right - 1,
                outerR.Bottom - 1);

            GraphicsPath outer = RoundRectangle(outerR, 2);
            GraphicsPath inner = RoundRectangle(innerR, 2);
            GraphicsPath glossy = RoundRectangle(glossyR, 2);

            using (LinearGradientBrush b = new LinearGradientBrush(
                innerR, ColorTable.ItemGroupBgNorth, ColorTable.ItemGroupBgSouth, 90))
            {
                e.Graphics.FillPath(b, inner);
            }

            using (LinearGradientBrush b = new LinearGradientBrush(
                glossyR, ColorTable.ItemGroupBgGlossy, Color.Transparent, 90))
            {
                e.Graphics.FillPath(b, glossy);
            }

            outer.Dispose();
            inner.Dispose();
        }