Example #1
0
        public override void Render(Graphics graphics)
        {
            if (BackColor.A > 0)
            {
                var rect        = new Rectangle(AbsoluteLocation, Size);
                var linearBrush = new LinearGradientBrush(rect, BackColor, BackColor.Substract(Color.FromArgb(0, 90, 90, 90)), LinearGradientMode.Vertical);
                graphics.FillRectangle(linearBrush, rect);
            }

            graphics.DrawString(Name, Font, new SolidBrush(Color.Black), AbsoluteLocation.X + 5, AbsoluteLocation.Y + 5);

            base.Render(graphics);

            if (IsHighlighted)
            {
                using (var pen = new Pen(Color.Orange, 1))
                {
                    graphics.DrawRectangle(pen, AbsoluteLocation.X - 3, AbsoluteLocation.Y - 2, Size.Width + 5, Size.Height + 4);
                }

                IsHighlighted = false;
            }
        }