Пример #1
0
        private void UpdateBrightnessFromMouse(EventArgs e)
        {
            var mouseEv = (MouseEventArgs)(e);

            var handleToChange = Handles.Single(x => x.HandleNumber == _currentHandle);

            handleToChange.Brightness = 1 - (float)mouseEv.Y / ClientRectangle.Height;

            if (handleToChange.Brightness + handleToChange.BrightnessRange > 1)
            {
                handleToChange.Brightness = 1 - handleToChange.BrightnessRange;
            }
            if (handleToChange.Brightness - handleToChange.BrightnessRange < 0)
            {
                handleToChange.Brightness = handleToChange.BrightnessRange;
            }

            Invalidate();
            BrightnessesChanged?.Invoke(null, null);
        }
Пример #2
0
        private void UpdateRangeFromMouse(EventArgs e)
        {
            var mouseEv = (MouseEventArgs)(e);

            var handleToChange = Handles.Single(x => x.HandleNumber == _currentRangeHandle);

            var brightnessRangeRaw = (1 - (float)mouseEv.Y / ClientRectangle.Height);

            handleToChange.BrightnessRange = brightnessRangeRaw > handleToChange.Brightness ? brightnessRangeRaw - handleToChange.Brightness : handleToChange.Brightness - brightnessRangeRaw;

            if (handleToChange.Brightness + handleToChange.BrightnessRange > 1)
            {
                handleToChange.BrightnessRange = 1 - handleToChange.Brightness;
            }
            if (handleToChange.Brightness - handleToChange.BrightnessRange < 0)
            {
                handleToChange.BrightnessRange = handleToChange.Brightness;
            }

            Invalidate();
            BrightnessesChanged?.Invoke(null, null);
        }