protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (_usedBars == null) return;
using (LinearGradientBrush brush = new LinearGradientBrush(DisplayRectangle, _startColor, _endColor, LinearGradientMode.Vertical))
{
e.Graphics.FillRectangle(brush, new Rectangle(0, 0, _usedBars.Length * BlockSize.Width, BlockSize.Height));
}
using (Pen pen = new Pen(Color.FromArgb(75,255,255,255)))
{
for (int i = 0; i < _usedBars.Length; i++)
{
e.Graphics.DrawLine(pen, (i + 1) * BlockSize.Width, 0, (i + 1) * BlockSize.Width, BlockSize.Height);
}
pen.Color = Color.FromArgb(51, 51, 51);
e.Graphics.DrawLine(pen, 0, Height - 1, _usedBars.Length * BlockSize.Width, Height - 1);
}
}