示例#1
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case WM_NOTIFY:
                var nmhdr = (NMHDR)Marshal.PtrToStructure(m.LParam, typeof(NMHDR));
                switch (nmhdr.code)
                {
                case NM_RCLICK:
                    OnContextMenu.Raise(this, new EventArgs());
                    break;

                case TVN_SELCHANGED:
                    OnSelectionChanged.Raise(this, new EventArgs());
                    break;
                }
                break;

            case WM_CONTEXTMENU:
                OnContextMenu.Raise(this, new EventArgs());
                break;
            }

            base.WndProc(ref m);
        }