protected override void WndProc(ref Message m) { if (MessagePumpManager == null || !MessagePumpManager.PumpMessage(ref m)) { switch (m.Msg) { case WM.NCRBUTTONUP: //Open context menu if right button clicked on caption (i.e. all of the window area because of glass) if (m.WParam.ToInt32() == HT.CAPTION) { OpenContextMenu(null); m.Result = IntPtr.Zero; return; } break; case WM.NCHITTEST: //Make transparent to hit-testing if in click through mode if (ClickThroughEnabled) { m.Result = (IntPtr)HT.TRANSPARENT; RefreshClickThroughComeBack(); return; } break; } base.WndProc(ref m); } }
void TaskIcon_doubleclick(object sender, EventArgs e) => ClickThroughEnabled = false;//强制取消点击穿透 #region Event override protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); KeepAspectRatio = false; GlassMargins = new Padding(-1); MessagePumpManager.Initialize(this); }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); MessagePumpManager.Dispose(); }