using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BiskLog_Point_Of_Sale.Classes { class gradientPanel : Panel { Color TopColor; Color BottomColor; public Color ColorTop { get { return TopColor; } set { TopColor = value; Invalidate(); } } public Color ColorBottom { get { return BottomColor; } set { BottomColor = value; Invalidate(); } } public gradientPanel() { DoubleBuffered = true; } protected override void OnPaint(PaintEventArgs e) { Rectangle rec = this.ClientRectangle; if (rec.Width == 0) rec.Width = 1; if (rec.Height == 0) rec.Height = 1; LinearGradientBrush lgb = new LinearGradientBrush(rec, this.ColorTop, this.ColorBottom, 90F); Graphics g = e.Graphics; g.FillRectangle(lgb, rec); base.OnPaint(e); } } }