diff --git a/Source/OpenNest.Core/Quantity.cs b/Source/OpenNest.Core/Quantity.cs index 2a022a4..8643e68 100644 --- a/Source/OpenNest.Core/Quantity.cs +++ b/Source/OpenNest.Core/Quantity.cs @@ -8,7 +8,11 @@ public int Remaining { - get { return Required - Nested; } + get + { + var x = Required - Nested; + return x < 0 ? 0: x; + } } } } diff --git a/Source/OpenNest/Controls/DrawingListBox.cs b/Source/OpenNest/Controls/DrawingListBox.cs index 272e684..efbbe4a 100644 --- a/Source/OpenNest/Controls/DrawingListBox.cs +++ b/Source/OpenNest/Controls/DrawingListBox.cs @@ -27,6 +27,8 @@ namespace OpenNest.Controls public Units Units { get; set; } + public bool HideDepletedParts { get; set; } + protected override void OnDrawItem(DrawItemEventArgs e) { if (e.Index >= Items.Count || e.Index <= -1) @@ -37,7 +39,10 @@ namespace OpenNest.Controls if (dwg == null) return; - e.Graphics.FillRectangle(Brushes.White, e.Bounds); + var isComplete = dwg.Quantity.Nested > 0 && dwg.Quantity.Remaining == 0; + var bgBrush = isComplete ? SystemBrushes.Info : Brushes.White; + + e.Graphics.FillRectangle(bgBrush, e.Bounds); var pt = new PointF(5, e.Bounds.Y + 5);