public void ClearTrackedControl() { if (this.trackedControl is null) { return; } NonClientControlProperties.SetIsNCMouseOver(this.trackedControl, false); NonClientControlProperties.SetIsNCPressed(this.trackedControl, false); this.trackedControl = null; }
public bool PressTrackedControl(IntPtr lParam) { var controlUnderMouse = this.GetControlUnderMouse(lParam); if (controlUnderMouse != this.trackedControl) { this.HoverTrackedControl(lParam); } if (this.trackedControl is null) { return(false); } NonClientControlProperties.SetIsNCPressed(this.trackedControl, true); var nonClientControlClickStrategy = NonClientControlProperties.GetClickStrategy(this.trackedControl); if (nonClientControlClickStrategy is NonClientControlClickStrategy.MouseEvent) { // Raising LBUTTONDOWN here automatically causes a LBUTTONUP to be raised by windows later correctly PInvoke.RaiseMouseMessage(this.OwnerHandle, WM.LBUTTONDOWN, default, lParam);
public bool HoverTrackedControl(IntPtr lParam) { var controlUnderMouse = this.GetControlUnderMouse(lParam); if (controlUnderMouse == this.trackedControl) { return(true); } if (this.trackedControl is not null) { NonClientControlProperties.SetIsNCMouseOver(this.trackedControl, false); NonClientControlProperties.SetIsNCPressed(this.trackedControl, false); } this.trackedControl = controlUnderMouse; if (this.trackedControl is not null) { NonClientControlProperties.SetIsNCMouseOver(this.trackedControl, true); } return(true); }