From 09806d5f14b98d68ba6085bc328e505fe7f0da07 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sat, 25 May 2013 01:11:05 -0400 Subject: [PATCH] Somewhat reduce flickering on select changes --- .../MultiSelectTreeView/MultiSelectTreeview.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Vendor/MultiSelectTreeView/MultiSelectTreeview.cs b/Vendor/MultiSelectTreeView/MultiSelectTreeview.cs index 26e0a3e..d8c41ee 100644 --- a/Vendor/MultiSelectTreeView/MultiSelectTreeview.cs +++ b/Vendor/MultiSelectTreeView/MultiSelectTreeview.cs @@ -23,6 +23,8 @@ namespace NBTExplorer.Vendor.MultiSelectTreeView } set { + BeginUpdate(); + ClearSelectedNodes(); if( value != null ) { @@ -31,6 +33,8 @@ namespace NBTExplorer.Vendor.MultiSelectTreeView ToggleNode( node, true ); } } + + EndUpdate(); } } @@ -53,6 +57,8 @@ namespace NBTExplorer.Vendor.MultiSelectTreeView public MultiSelectTreeView() { + SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); + m_SelectedNodes = new List(); base.SelectedNode = null; } @@ -581,5 +587,17 @@ namespace NBTExplorer.Vendor.MultiSelectTreeView } #endregion + + private const int WM_ERASEBKGND = 0x14; + + protected override void WndProc (ref Message m) + { + if (m.Msg == WM_ERASEBKGND) //if message is is erase background + { + return; + } + + base.WndProc(ref m); + } } }