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) <noreply@anthropic.com>
This commit is contained in:
@@ -152,6 +152,20 @@ namespace OpenNest.Controls
|
|||||||
{
|
{
|
||||||
if (m.Msg == WM_ERASEBKGND)
|
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;
|
m.Result = (IntPtr)1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user