Add accessibility text to grid stoplight buttons
This commit is contained in:
parent
d16d0c8de2
commit
d19fe2250c
@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Version>11.3.8.1</Version>
|
<Version>11.3.9.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Octokit" Version="10.0.0" />
|
<PackageReference Include="Octokit" Version="10.0.0" />
|
||||||
|
|||||||
@ -16,6 +16,26 @@ namespace LibationWinForms.GridView
|
|||||||
|
|
||||||
internal class LiberateDataGridViewImageButtonCell : DataGridViewImageButtonCell
|
internal class LiberateDataGridViewImageButtonCell : DataGridViewImageButtonCell
|
||||||
{
|
{
|
||||||
|
#region Accessibility
|
||||||
|
private string accessibilityName => "Liberate Image Button";
|
||||||
|
private string accessibilityDescription = "undefined";
|
||||||
|
protected override AccessibleObject CreateAccessibilityInstance() => new MyAccessibilityObject(accessibilityName, accessibilityDescription);
|
||||||
|
protected class MyAccessibilityObject : DataGridViewCellAccessibleObject
|
||||||
|
{
|
||||||
|
public override string Name => _name;
|
||||||
|
public override string Description => _description;
|
||||||
|
|
||||||
|
private string _name { get; }
|
||||||
|
private string _description { get; }
|
||||||
|
|
||||||
|
public MyAccessibilityObject(string name, string description) : base()
|
||||||
|
{
|
||||||
|
_name = name;
|
||||||
|
_description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
private static readonly Brush DISABLED_GRAY = new SolidBrush(Color.FromArgb(0x60, Color.LightGray));
|
private static readonly Brush DISABLED_GRAY = new SolidBrush(Color.FromArgb(0x60, Color.LightGray));
|
||||||
private static readonly Color HiddenForeColor = Color.LightGray;
|
private static readonly Color HiddenForeColor = Color.LightGray;
|
||||||
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
|
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
|
||||||
@ -31,6 +51,7 @@ namespace LibationWinForms.GridView
|
|||||||
base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, null, null, null, cellStyle, advancedBorderStyle, paintParts);
|
base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, null, null, null, cellStyle, advancedBorderStyle, paintParts);
|
||||||
|
|
||||||
DrawButtonImage(graphics, (Image)status.ButtonImage, cellBounds);
|
DrawButtonImage(graphics, (Image)status.ButtonImage, cellBounds);
|
||||||
|
accessibilityDescription = status.ToolTip;
|
||||||
ToolTipText = status.ToolTip;
|
ToolTipText = status.ToolTip;
|
||||||
|
|
||||||
if (status.IsUnavailable || status.Opacity < 1)
|
if (status.IsUnavailable || status.Opacity < 1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user