コード例 #1
0
        public void ClearTrackedControl()
        {
            if (this.trackedControl is null)
            {
                return;
            }

            NonClientControlProperties.SetIsNCMouseOver(this.trackedControl, false);
            NonClientControlProperties.SetIsNCPressed(this.trackedControl, false);
            this.trackedControl = null;
        }
コード例 #2
0
        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);
コード例 #3
0
        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);
        }