private void _pnlHistogram_Paint(object sender, PaintEventArgs e) { e.Graphics.Clear(_pnlHistogram.BackColor); if (_currentHistogram == null) { return; } double maxFreq = _currentHistogram.GetMaxFrequency(); for (int i = 0; i < _currentHistogram.Frequencies.Length; i++) { e.Graphics.DrawLine(Pens.Black, i, _pnlHistogram.Height, i, _pnlHistogram.Height - (float)(_pnlHistogram.Height * _currentHistogram.Frequencies[i] / maxFreq)); } }