diff --git a/app/Settings.cs b/app/Settings.cs index cf615a78..e0c71f20 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1263,6 +1263,10 @@ namespace GHelper { labelBatteryTitle.Text = Properties.Strings.BatteryChargeLimit + ": " + limit.ToString() + "%"; sliderBattery.Value = limit; + + sliderBattery.AccessibleName = Properties.Strings.BatteryChargeLimit + ": " + limit.ToString() + "%"; + sliderBattery.AccessibilityObject.Select(AccessibleSelection.TakeFocus); + VisualiseBatteryFull(); } @@ -1272,11 +1276,13 @@ namespace GHelper { buttonBatteryFull.BackColor = colorStandard; buttonBatteryFull.ForeColor = SystemColors.ControlLightLight; + buttonBatteryFull.AccessibleName = Properties.Strings.BatteryChargeLimit + "100% on"; } else { buttonBatteryFull.BackColor = buttonSecond; buttonBatteryFull.ForeColor = SystemColors.ControlDark; + buttonBatteryFull.AccessibleName = Properties.Strings.BatteryChargeLimit + "100% off"; } } @@ -1422,11 +1428,13 @@ namespace GHelper { buttonFnLock.BackColor = colorStandard; buttonFnLock.ForeColor = SystemColors.ControlLightLight; + buttonFnLock.AccessibleName = "Fn-Lock on"; } else { buttonFnLock.BackColor = buttonSecond; buttonFnLock.ForeColor = SystemColors.ControlDark; + buttonFnLock.AccessibleName = "Fn-Lock off"; } } diff --git a/app/UI/Slider.cs b/app/UI/Slider.cs index 40cd6fe8..0778dc78 100644 --- a/app/UI/Slider.cs +++ b/app/UI/Slider.cs @@ -36,6 +36,7 @@ namespace GHelper.UI { // This reduces flicker DoubleBuffered = true; + TabStop = true; } @@ -89,6 +90,41 @@ namespace GHelper.UI } } + + protected override bool IsInputKey(Keys keyData) + { + switch (keyData) + { + case Keys.Right: + case Keys.Left: + case Keys.Up: + case Keys.Down: + return true; + } + + return base.IsInputKey(keyData); + } + + protected override void OnKeyDown(KeyEventArgs e) + { + + switch (e.KeyCode) + { + case Keys.Right: + case Keys.Up: + Value = Math.Min(Max, Value + Step); + break; + case Keys.Left: + case Keys.Down: + Value = Math.Max(Min, Value - Step); + break; + } + + AccessibilityNotifyClients(AccessibleEvents.Focus, 0); + + base.OnKeyDown(e); + } + protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); @@ -131,6 +167,8 @@ namespace GHelper.UI { base.OnMouseDown(e); + Focus(); + // Difference between tumb and mouse position. _delta = new SizeF(e.Location.X - _thumbPos.X, e.Location.Y - _thumbPos.Y); if (_delta.Width * _delta.Width + _delta.Height * _delta.Height <= _radius * _radius)