From 11884e712d07f48abbb61affec42c71367734de7 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Tue, 7 Apr 2026 08:23:30 -0400 Subject: [PATCH] fix: clear empty area below items in drawing list on resize The WM_ERASEBKGND suppression from 3c4d00b left stale artifacts in the non-item region when the control was resized. Fill only the area below the last visible item so items still don't flicker. Co-Authored-By: Claude Opus 4.6 (1M context) --- OpenNest/Controls/DrawingListBox.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/OpenNest/Controls/DrawingListBox.cs b/OpenNest/Controls/DrawingListBox.cs index 3ec6407..1993fa2 100644 --- a/OpenNest/Controls/DrawingListBox.cs +++ b/OpenNest/Controls/DrawingListBox.cs @@ -152,6 +152,20 @@ namespace OpenNest.Controls { if (m.Msg == WM_ERASEBKGND) { + var itemBottom = 0; + + if (Items.Count > 0) + { + var lastVisible = System.Math.Min(TopIndex + (ClientSize.Height / ItemHeight), Items.Count - 1); + itemBottom = GetItemRectangle(lastVisible).Bottom; + } + + if (itemBottom < ClientSize.Height) + { + using var g = Graphics.FromHdc(m.WParam); + g.FillRectangle(Brushes.White, 0, itemBottom, ClientSize.Width, ClientSize.Height - itemBottom); + } + m.Result = (IntPtr)1; return; }