public void PaintHeaderBackground()
        {
            Graphics g = Graphics;
            Rectangle r = ClientBounds;

            Color color = BackColor;
            Color startColor = ColorConverter.AlphaBlendColor(Color.White, color, 100);
            if (IsTransparent)
            {
                color = ColorConverter.AlphaColor(color, 200);
                startColor = ColorConverter.AlphaColor(startColor, 150);
                using (GraphicsPlus gp = new GraphicsPlus(g))
                {
                    PointF p1 = new PointF(r.X, r.Y);
                    PointF p2 = new PointF(r.X, r.Bottom);
                    using (LinearGradientBrush backGround = new LinearGradientBrush(p1, p2, startColor, color))
                    {
                        gp.FillRectangle(backGround, r);
                    }
                }
            }
            else
            {
                GdiExt.GradientFill(g, r, startColor, color, GdiExt.FillDirection.TopToBottom);
            }
        }
        private void PaintTemplateBackground()
        {
            Graphics g = Graphics;
            Rectangle r = ClientBounds;

            Color color = BackColor;
            if (IsTransparent)
            {
                color = ColorConverter.AlphaColor(color, 220);
                using (GraphicsPlus gp = new GraphicsPlus(g))
                {
                    using (SolidBrushPlus backGround = new SolidBrushPlus(color))
                    {
                        gp.FillRectangle(backGround, r);
                    }
                }
            }
            else
            {
                using (SolidBrush brush = new SolidBrush(color))
                {
                    g.FillRectangle(brush, r);
                }
            }
        }
Beispiel #3
0
 protected virtual void OnPaintBackground(FluidPaintEventArgs e)
 {
     if (PaintBackground != null) PaintBackground(this, e);
     else
     {
         if (!BackColor.IsEmpty && BackColor != Color.Transparent)
         {
             Graphics g = e.Graphics;
             if (BackColor.A == 255 || BackColor.A == 0)
             {
                 SolidBrush brush = Brushes.GetBrush(BackColor);
                 g.FillRectangle(brush, e.ControlBounds);
             }
             else
             {
                 using (GraphicsPlus gp = new GraphicsPlus(g))
                 {
                     using (SolidBrushPlus brush = new SolidBrushPlus(BackColor))
                     {
                         gp.FillRectangle(brush, e.ControlBounds);
                     }
                 }
             }
         }
     }
 }