protected override void WndProc(ref Message m) { base.WndProc(ref m); const int WM_NCHITTEST = 0x84; const int HTBOTTOMRIGHT = 17; const int gripSize = 16; if (m.Msg == WM_NCHITTEST && !this.Locked) { var posisiton = new Point(m.LParam.ToInt32() & 0xFFFF, m.LParam.ToInt32() >> 16); posisiton = this.PointToClient(posisiton); if (posisiton.X >= this.ClientSize.Width - gripSize && posisiton.Y >= this.ClientSize.Height - gripSize) { m.Result = (IntPtr)HTBOTTOMRIGHT; return; } } if (m.Msg == NativeMethods.WM_KEYDOWN || m.Msg == NativeMethods.WM_KEYUP || m.Msg == NativeMethods.WM_CHAR || m.Msg == NativeMethods.WM_SYSKEYDOWN || m.Msg == NativeMethods.WM_SYSKEYUP || m.Msg == NativeMethods.WM_SYSCHAR) { Renderer.OnKeyEvent(ref m); } }
protected override void WndProc(ref Message m) { if (m.Msg == NativeMethods.WM_KEYDOWN || m.Msg == NativeMethods.WM_KEYUP || m.Msg == NativeMethods.WM_CHAR || m.Msg == NativeMethods.WM_SYSKEYDOWN || m.Msg == NativeMethods.WM_SYSKEYUP || m.Msg == NativeMethods.WM_SYSCHAR) { Renderer.OnKeyEvent(ref m); } else { base.WndProc(ref m); } }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { // Override the default behavior for these keys to avoid focus loss. case Keys.Up: case Keys.Down: case Keys.Left: case Keys.Right: case Keys.Tab: Renderer.OnKeyEvent(ref msg); return(true); default: return(base.ProcessCmdKey(ref msg, keyData)); } }