示例#1
0
            protected unsafe override void WndProc(ref Message m)
            {
                switch (m.Msg)
                {
                case (int)LVM.HITTEST:
                case (int)LVM.GETITEM:
                case (int)LVM.GETITEMRECT:
                case (int)LVM.GETITEMCOUNT:
                case (int)LVM.GETITEMSTATE:
                case (int)LVM.GETNEXTITEM:
                case (int)LVM.FINDITEM:
                case (int)LVM.UPDATE:
                case (int)LVM.SETTEXTBKCOLOR:
                case (int)LVM.SETTEXTCOLOR:
                case (int)LVM.SETBKCOLOR:
                case (int)LVM.ENABLEGROUPVIEW:
                case (int)LVM.SETIMAGELIST:
                case (int)LVM.SETITEMSTATE:
                case (int)LVM.SETVIEW:
                case (int)User32.WindowMessage.WM_NCCREATE:
                case (int)User32.WindowMessage.WM_NCCALCSIZE:
                case (int)User32.WindowMessage.WM_CREATE:
                case (int)User32.WindowMessage.WM_MOUSEHOVER:
                case (int)User32.WindowMessage.WM_MOUSELEAVE:
                case (int)User32.WindowMessage.WM_MOUSEMOVE:
                case (int)User32.WindowMessage.WM_NCHITTEST:
                case (int)User32.WindowMessage.WM_SETCURSOR:
                case (int)User32.WindowMessage.WM_SETREDRAW:
                case (int)User32.WindowMessage.WM_KILLFOCUS:
                case (int)User32.WindowMessage.WM_PAINT:
                case (int)User32.WindowMessage.WM_ERASEBKGND:
                case (int)User32.WindowMessage.WM_CAPTURECHANGED:
                case (int)User32.WindowMessage.WM_SIZE:
                case (int)User32.WindowMessage.WM_MOVE:
                case (int)User32.WindowMessage.WM_IME_SETCONTEXT:
                case (int)User32.WindowMessage.WM_IME_NOTIFY:
                case (int)User32.WindowMessage.WM_SETFOCUS:
                    base.WndProc(ref m);
                    break;

                case (int)User32.WindowMessage.WM_LBUTTONUP:
                    base.DefWndProc(ref m);
                    break;

                case (int)User32.WindowMessage.WM_REFLECT_NOTIFY:
                    User32.NMHDR *nmhdr = (User32.NMHDR *)m.LParam;
                    switch (nmhdr->code)
                    {
                    case (int)LVN.LINKCLICK:
                        NMLVLINK *link  = (NMLVLINK *)m.LParam;
                        string    task  = "Clicked";
                        var       group = new LVGROUPW
                        {
                            cbSize  = (uint)sizeof(LVGROUPW),
                            mask    = LVGF.TASK,
                            cchTask = (uint)task.Length
                        };
                        fixed(char *pTask = "Clicked")
                        {
                            group.pszTask = pTask;
                            User32.SendMessageW(Handle, (User32.WindowMessage)LVM.SETGROUPINFO, (IntPtr)link->iSubItem, ref group);
                            MessageBox.Show("Link Clicked");
                        }

                        break;

                    case (int)LVN.GETDISPINFOW:
                    case (int)LVN.ITEMCHANGING:
                    case (int)LVN.ITEMCHANGED:
                    case (int)LVN.INSERTITEM:
                    case (int)LVN.MARQUEEBEGIN:
                    case (int)LVN.HOTTRACK:
                    case (int)NM.SETFOCUS:
                    case (int)NM.KILLFOCUS:
                    case (int)NM.CUSTOMDRAW:
                    case (int)NM.RELEASEDCAPTURE:
                    case (int)NM.CLICK:
                    default:
                        break;
                    }

                    base.WndProc(ref m);
                    break;

                default:

                    //Debug.WriteLine((User32.WindowMessage)m.Msg);
                    base.WndProc(ref m);
                    break;
                }
            }
示例#2
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            spreadsheetPanel1.GetSelection(out int col, out int row);
            string name, contents;

            //keypress handling logic
            switch (keyData)
            {
            case Keys.Up:
                contents = cellContentsField.Text;
                if (contentsChanged == true)
                {
                    SetCell(col, row, contents);
                }
                row--;
                break;

            case Keys.Enter:
            case Keys.Down:
                contents = cellContentsField.Text;
                if (contentsChanged == true)
                {
                    SetCell(col, row, contents);
                }
                row++;
                break;

            case Keys.Left:
                contents = cellContentsField.Text;
                if (contentsChanged == true)
                {
                    SetCell(col, row, contents);
                }
                col--;
                break;

            case Keys.Tab:
            case Keys.Right:
                contents = cellContentsField.Text;
                if (contentsChanged == true)
                {
                    SetCell(col, row, contents);
                }
                col++;
                break;

            //pass key event onto regular form handling
            default:
                return(base.ProcessCmdKey(ref msg, keyData));
            }

            //update selection
            if (spreadsheetPanel1.SetSelection(col, row))
            {
                name = GetCellName(col, row);
                UpdateGUIFields(name);
            }

            //event has been handled
            return(true);
        }
示例#3
0
 protected override void WndProc(ref Message m)
 {
     //窗口消息处理函数
     hotKeys.ProcessHotKey(m);
     base.WndProc(ref m);
 }