2023-04-07 20:25:39 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace WinFormSample
|
|
|
|
|
{
|
|
|
|
|
static class ControlExtensions
|
|
|
|
|
{
|
2023-04-08 09:20:57 +08:00
|
|
|
|
public static void SetDoubleBufferedAsNeeded(this Control control)
|
2023-04-07 20:25:39 +08:00
|
|
|
|
{
|
|
|
|
|
var dbprop = control.GetType().GetProperty("DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance);
|
2023-04-08 09:20:57 +08:00
|
|
|
|
dbprop!.SetValue(control, !SystemInformation.TerminalServerSession);
|
2023-04-07 20:25:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|