Browse Source
Merge branch 'master' into fix-polygon-polyline-unload-points-in-template
pull/12651/head
ZhangXi
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
3 deletions
-
src/Avalonia.Controls/Primitives/AccessText.cs
|
|
|
@ -3,6 +3,7 @@ using Avalonia.Input; |
|
|
|
using Avalonia.Reactive; |
|
|
|
using Avalonia.Media; |
|
|
|
using Avalonia.Media.TextFormatting; |
|
|
|
using System; |
|
|
|
|
|
|
|
namespace Avalonia.Controls.Primitives |
|
|
|
{ |
|
|
|
@ -68,11 +69,15 @@ namespace Avalonia.Controls.Primitives |
|
|
|
if (underscore != -1 && ShowAccessKey) |
|
|
|
{ |
|
|
|
var rect = TextLayout!.HitTestTextPosition(underscore); |
|
|
|
var offset = new Vector(0, -1.5); |
|
|
|
|
|
|
|
var x1 = Math.Round(rect.Left, MidpointRounding.AwayFromZero); |
|
|
|
var x2 = Math.Round(rect.Right, MidpointRounding.AwayFromZero); |
|
|
|
var y = Math.Round(rect.Bottom, MidpointRounding.AwayFromZero) - 1.5; |
|
|
|
|
|
|
|
context.DrawLine( |
|
|
|
new Pen(Foreground, 1), |
|
|
|
rect.BottomLeft + offset, |
|
|
|
rect.BottomRight + offset); |
|
|
|
new Point(x1, y), |
|
|
|
new Point(x2, y)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|