diff --git a/OpenNest/Controls/DrawingListBox.cs b/OpenNest/Controls/DrawingListBox.cs index 9982b16..3ec6407 100644 --- a/OpenNest/Controls/DrawingListBox.cs +++ b/OpenNest/Controls/DrawingListBox.cs @@ -8,16 +8,14 @@ namespace OpenNest.Controls public class DrawingListBox : ListBox { + private const int WM_ERASEBKGND = 0x0014; + private readonly Size imageSize; private readonly Font nameFont; private Point lastClickLocation; public DrawingListBox() { - SetStyle( - ControlStyles.AllPaintingInWmPaint | - ControlStyles.OptimizedDoubleBuffer, true); - DrawMode = DrawMode.OwnerDrawFixed; ItemHeight = 85; @@ -149,6 +147,16 @@ namespace OpenNest.Controls base.OnMouseDown(e); lastClickLocation = e.Location; } + + protected override void WndProc(ref Message m) + { + if (m.Msg == WM_ERASEBKGND) + { + m.Result = (IntPtr)1; + return; + } + base.WndProc(ref m); + } } public static class PointExtensions