protected virtual void FilterMessage(object sender, FilterMessageEventArgs e) { if (e.Handled) return; if (Manager == null) return; switch (e.Msg) { case WM_SIZE: case WM_MOVE: break; case WM_NCRBUTTONDOWN: //Right button click on title area -> show context menu if (e.WParam.ToInt32() == HTCAPTION) { short x = (short)((e.LParam.ToInt32() & 0xFFFF)); short y = (short)((e.LParam.ToInt32() >> 16)); OpenContextMenu(null, new Point(x, y)); e.Handled = true; } break; case WM_NCRBUTTONUP: //set as handled right button click on title area (after showing context menu) if (e.WParam.ToInt32() == HTCAPTION) { e.Handled = true; } break; } }
protected override void FilterMessage(object sender, FilterMessageEventArgs e) { e.Handled = false; if (Manager == null) return; switch (e.Msg) { case WM_NCLBUTTONDOWN: //Left button down on title -> start dragging over docking manager if (IsDockableWindow && e.WParam.ToInt32() == HTCAPTION) { short x = (short)((e.LParam.ToInt32() & 0xFFFF)); short y = (short)((e.LParam.ToInt32() >> 16)); Point clickPoint = this.TransformToDeviceDPI(new Point(x, y)); Manager.Drag(this, clickPoint, new Point(clickPoint.X - Left, clickPoint.Y - Top)); e.Handled = true; } break; case WM_NCLBUTTONDBLCLK: //Left Button Double Click -> dock to docking manager if (IsDockableWindow && e.WParam.ToInt32() == HTCAPTION) { if (IsDockableWindow) { Dock(); e.Handled = true; } } break; } base.FilterMessage(sender, e); }