rendered paste body protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e)
{
if (e.ColumnIndex == progressBarItemIndex)
using (Pen borderPen = new Pen(Color.SlateGray))
using (Pen backgroundPen = new Pen(Color.White))
using (SolidBrush backgroundBrush = new SolidBrush(Color.White))
using (SolidBrush fillBrush = new SolidBrush(Color.DarkGray))
{
if ((e.ItemState & ListViewItemStates.Selected) != 0)
e.Graphics.FillRectangle(SystemBrushes.Highlight, e.SubItem.Bounds);
e.Graphics.DrawRectangle(borderPen, e.SubItem.Bounds.X, e.SubItem.Bounds.Y + 2, e.SubItem.Bounds.Width - 1, e.SubItem.Bounds.Height - 5);
e.Graphics.DrawRectangle(backgroundPen, e.SubItem.Bounds.X + 1, e.SubItem.Bounds.Y + 3, e.SubItem.Bounds.Width - 3, e.SubItem.Bounds.Height - 7);
ProgressState progressState = e.SubItem.Tag as ProgressState;
e.Graphics.FillRectangle(backgroundBrush, e.SubItem.Bounds.X + 2, e.SubItem.Bounds.Y + 4, e.SubItem.Bounds.Width - 4, e.SubItem.Bounds.Height - 8);
e.Graphics.FillRectangle(fillBrush, e.SubItem.Bounds.X + 2, e.SubItem.Bounds.Y + 4, (e.SubItem.Bounds.Width - 4) * progressState.value / progressState.maximumValue, e.SubItem.Bounds.Height - 8);
}
else
e.DrawDefault = true;
}