我的控件闪烁有问题。我有拖放操作,拖动控件时,它会闪烁。我该如何解决?我试过这个
public Form1()
{
InitializeComponent();
.
.
.
this.DoubleBuffered = true;
}
但是对我没用。我该如何解决?
答案 0 :(得分:0)
public static void SetDoubleBuffered(System.Windows.Forms.Control c)
{
//Taxes: Remote Desktop Connection and painting
//http://blogs.msdn.com/oldnewthing/archive/2006/01/03/508694.aspx
if (System.Windows.Forms.SystemInformation.TerminalServerSession)
return;
System.Reflection.PropertyInfo aProp =
typeof(System.Windows.Forms.Control).GetProperty(
"DoubleBuffered",
System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance);
aProp.SetValue(c, true, null);
}
这种方法有很大帮助。
从这里开始