using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace OpcUaHelper.Forms { /// /// 无闪烁的树节点控件,结果还是没有实现 /// public class TreeViewEx : TreeView { /// /// 实例化一个新的控件 /// public TreeViewEx() { // 开启双缓冲 SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); // Enable the OnNotifyMessage event so we get a chance to filter out // Windows messages before they get to the form's WndProc SetStyle(ControlStyles.EnableNotifyMessage, true); } /// /// 通知 /// /// protected override void OnNotifyMessage(Message m) { //Filter out the WM_ERASEBKGND message if (m.Msg != 0x14) { base.OnNotifyMessage(m); } } //protected override void WndProc(ref Message m) //{ // if (m.Msg == 0x0014) // 禁掉清除背景消息 // return; // base.WndProc(ref m); //} } }