Skip to content

Commit

Permalink
reduce flickering on ListView updates
Browse files Browse the repository at this point in the history
  • Loading branch information
g3gg0 committed Oct 2, 2022
1 parent aa876b0 commit 881b365
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions TeddyBench/Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TeddyBench
{
public static class Extensions
{
public static void DoubleBuffered(this Control control, bool enable)
{
var doubleBufferPropertyInfo = control.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
doubleBufferPropertyInfo.SetValue(control, enable, null);
}

}
}
1 change: 1 addition & 0 deletions TeddyBench/TeddyMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public TeddyMain()
lstTonies.LargeImageList.Images.Add("unknown", ResizeImage(Resources.unknown, 128, 128));
lstTonies.LargeImageList.Images.Add("custom", ResizeImage(Resources.custom, 128, 128));
lstTonies.ListViewItemSorter = new ListViewItemComparer(2);
lstTonies.DoubleBuffered(true);
cmbSorting.SelectedIndex = 2;
Text = TitleString;

Expand Down

0 comments on commit 881b365

Please sign in to comment.