Esempio n. 1
0
 public void Dispose()
 {
     foreach (var property in this.GetType().GetProperties().Where(p => p.PropertyType == typeof(RibbonColorItem)))
     {
         RibbonColorItem item = (RibbonColorItem)property.GetValue(this, new object[] { });
         item.Dispose();
     }
 }
Esempio n. 2
0
        public virtual void DrawPressedButtonPanel(Graphics g, Rectangle bounds, double ratio)
        {
            RibbonColorItem i1 = this.ButtonPressedBackground1;
            RibbonColorItem i2 = this.ButtonPressedBackground2;
            RibbonColorItem i3 = this.ButtonPressedBackground3;
            RibbonColorItem i4 = this.ButtonPressedBackground4;

            this.DrawDoubleGradientPanel(g, i1, i2, i3, i4, Rectangle.Inflate(bounds, 0, -1), ratio);
        }
Esempio n. 3
0
        public virtual void DrawPressedButtonBorder(Graphics g, Rectangle bounds)
        {
            RibbonColorItem outTop    = this.ButtonPressedOuterBorderTop;
            RibbonColorItem outBottom = this.ButtonPressedOuterBorderBottom;
            RibbonColorItem inTop     = this.ButtonPressedInnerBorderTop;
            RibbonColorItem inBottom  = this.ButtonPressedInnerBorderBottom;

            this.DrawDoubleGradientBorder(g, outTop, outBottom, inTop, inBottom, bounds);
        }
Esempio n. 4
0
        public virtual void DrawCarvedText(Graphics g, RibbonColorItem light, RibbonColorItem dark, Rectangle bounds, string text, Font font)
        {
            SizeF size = g.MeasureString(text, font);
            int   x    = bounds.Left + (int)(bounds.Width - size.Width) / 2;
            int   y    = bounds.Top + (int)(bounds.Height - size.Height) / 2;

            g.DrawString(text, font, light.Brush, x + 1, y + 1);
            g.DrawString(text, font, dark.Brush, x, y);
        }
Esempio n. 5
0
        public virtual void DrawCarvedBorder(Graphics g, RibbonColorItem light, RibbonColorItem dark, Rectangle bounds)
        {
            Rectangle darkBounds  = bounds;
            Rectangle lightBounds = bounds;

            {
                darkBounds.Width   -= 2;
                darkBounds.Height  -= 2;
                lightBounds.X      += 1;
                lightBounds.Y      += 1;
                lightBounds.Width  -= 2;
                lightBounds.Height -= 2;
            }
            g.DrawRectangle(light.Pen, lightBounds);
            g.DrawRectangle(dark.Pen, darkBounds);
        }
Esempio n. 6
0
        public virtual void RenderPanel(Graphics g, RibbonThemaSettingsBase settings, Rectangle panelBounds)
        {
            RibbonColorItem i1 = settings.Panel1;
            RibbonColorItem i2 = settings.Panel2;
            RibbonColorItem i3 = settings.Panel3;
            RibbonColorItem i4 = settings.Panel4;

            settings.DrawDoubleGradientPanel(g, i1, i2, i3, i4, panelBounds, (double)1 / 6);
            foreach (var group in this.realGroups)
            {
                group.Render(g, settings, this.GetGroupBounds(group));
            }
            panelBounds.Width  -= 1;
            panelBounds.Height -= 1;
            g.DrawRectangle(settings.Border.Pen, panelBounds);
        }
Esempio n. 7
0
        public virtual void DrawRightDropDownTriangle(Graphics g, RibbonColorItem light, RibbonColorItem dark, Rectangle bounds)
        {
            int x1 = bounds.Left;
            int x2 = bounds.Right;
            int y1 = bounds.Top - 1;
            int y2 = bounds.Top + bounds.Height / 2;
            int y3 = bounds.Bottom;

            Point[] points = new Point[3];
            points[0].X = x1;
            points[0].Y = y1;
            points[1].X = x2;
            points[1].Y = y2;
            points[2].X = x1;
            points[2].Y = y3;

            using (LinearGradientBrush brush = new LinearGradientBrush(Rectangle.Inflate(bounds, 1, 1), light.Color, dark.Color, 270))
            {
                g.FillPolygon(brush, points);
            }
        }
Esempio n. 8
0
        public virtual void DrawDoubleGradientPanel(Graphics g, RibbonColorItem i1, RibbonColorItem i2, RibbonColorItem i3, RibbonColorItem i4, Rectangle bounds, double upRatio)
        {
            Rectangle upBounds   = bounds;
            Rectangle downBounds = bounds;
            int       upHeight   = (int)(bounds.Height * upRatio);

            {
                upBounds.Width    -= 1;
                upBounds.Height    = upHeight;
                downBounds.Y      += upHeight;
                downBounds.Width  -= 1;
                downBounds.Height -= upHeight;
            }
            using (LinearGradientBrush brush = new LinearGradientBrush(Rectangle.Inflate(upBounds, 1, 1), i1.Color, i2.Color, 90.0f))
            {
                g.FillRectangle(brush, upBounds);
            }
            using (LinearGradientBrush brush = new LinearGradientBrush(Rectangle.Inflate(downBounds, 1, 1), i3.Color, i4.Color, 90.0f))
            {
                g.FillRectangle(brush, downBounds);
            }
        }
Esempio n. 9
0
        public virtual void DrawDoubleGradientBorder(Graphics g, RibbonColorItem outTop, RibbonColorItem outBottom, RibbonColorItem inTop, RibbonColorItem inBottom, Rectangle bounds)
        {
            int ox1 = bounds.Left;
            int oy1 = bounds.Top;
            int ox2 = bounds.Right - 1;
            int oy2 = bounds.Bottom - 1;
            int ix1 = ox1 + 1;
            int iy1 = oy1 + 1;
            int ix2 = ox2 - 1;
            int iy2 = oy2 - 1;

            using (GraphicsPath path = new GraphicsPath())
            {
                path.AddLine(ix1, oy1, ix2, oy1);
                path.AddLine(ox2, iy1, ox2, iy2);
                path.AddLine(ix2, oy2, ix1, oy2);
                path.AddLine(ox1, iy2, ox1, iy1);
                using (LinearGradientBrush brush = new LinearGradientBrush(Rectangle.Inflate(bounds, 1, 1), outTop.Color, outBottom.Color, 90.0f))
                    using (Pen pen = new Pen(brush))
                    {
                        path.Widen(pen);
                        g.FillPath(brush, path);
                    }
            }
            using (GraphicsPath path = new GraphicsPath())
            {
                path.AddLine(ix1, iy1, ix2, iy1);
                path.AddLine(ix2, iy1, ix2, iy2);
                path.AddLine(ix2, iy2, ix1, iy2);
                path.AddLine(ix1, iy2, ix1, iy1);
                using (LinearGradientBrush brush = new LinearGradientBrush(Rectangle.Inflate(bounds, 1, 1), inTop.Color, inBottom.Color, 90.0f))
                    using (Pen pen = new Pen(brush))
                    {
                        path.Widen(pen);
                        g.FillPath(brush, path);
                    }
            }
        }