コード例 #1
0
 public void DrawSeparatorText(RibbonItemBoundsEventArgs e, RibbonSeparator sep)
 {
     using (Brush b = new SolidBrush(GetTextColor(sep.Enabled)))
     {
         e.Graphics.DrawString(sep.Text, new Font(sep.Owner.Font, FontStyle.Bold), b, e.Bounds);
     }
 }
コード例 #2
0
        public void DrawSeparator(Graphics g, RibbonSeparator separator)
        {
            if (separator.SizeMode == RibbonElementSizeMode.DropDown)
            {
                if (!string.IsNullOrEmpty(separator.Text))
                {
                    using (var b = new SolidBrush(ColorTable.SeparatorBg))
                    {
                        g.FillRectangle(b, separator.Bounds);
                    }

                    using (var p = new Pen(ColorTable.SeparatorLine))
                    {
                        g.DrawLine(p,
                                   new Point(separator.Bounds.Left, separator.Bounds.Bottom),
                                   new Point(separator.Bounds.Right, separator.Bounds.Bottom));
                    }
                }
                else
                {
                    using (var p = new Pen(ColorTable.DropDownImageSeparator))
                    {
                        g.DrawLine(p,
                                   new Point(separator.Bounds.Left + 30, separator.Bounds.Top + 1),
                                   new Point(separator.Bounds.Right, separator.Bounds.Top + 1));
                    }
                }
            }
            else
            {
                using (var p = new Pen(ColorTable.SeparatorDark))
                {
                    g.DrawLine(p,
                               new Point(separator.Bounds.Left, separator.Bounds.Top),
                               new Point(separator.Bounds.Left, separator.Bounds.Bottom));
                }

                using (var p = new Pen(ColorTable.SeparatorLight))
                {
                    g.DrawLine(p,
                               new Point(separator.Bounds.Left + 1, separator.Bounds.Top),
                               new Point(separator.Bounds.Left + 1, separator.Bounds.Bottom));
                }
            }
        }