Last active
September 23, 2020 02:34
-
-
Save jayu108/282fad0c94aad8c775b9d9923fa8a2ad to your computer and use it in GitHub Desktop.
C# -- listview, panel 에서 double buffered, ResizeRedraw Extension 사용한 example code ( Reflection 이용)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Reflection; // 반드시 필요함. | |
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
this.SetStyle(ControlStyles.ResizeRedraw, true); | |
this.listView1.DoubleBuffered(true); // DoubleBuffered Extension 사용 | |
this.drawingPanel.ResizeRedraw(true); // ResizeRedraw Extension 사용 | |
} | |
} | |
public static class Extensions | |
{ | |
public static void ResizeRedraw(this Control control, bool enabled) | |
{ | |
var prop = control.GetType().GetProperty("ResizeRedraw", BindingFlags.Instance | BindingFlags.NonPublic); | |
prop.SetValue(control, enabled, null); | |
} | |
public static void DoubleBuffered(this Control control, bool enabled) | |
{ | |
var prop = control.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); | |
prop.SetValue(control, enabled, null); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment