| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace OpcUaHelper.Forms
- {
- /// <summary>
- /// 无闪烁的树节点控件,结果还是没有实现
- /// </summary>
- public class TreeViewEx : TreeView
- {
- /// <summary>
- /// 实例化一个新的控件
- /// </summary>
- 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);
- }
- /// <summary>
- /// 通知
- /// </summary>
- /// <param name="m"></param>
- 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);
- //}
- }
- }
|