Fix NumericUpDown icons position

This commit is contained in:
Javier Suárez Ruiz 2022-06-12 17:23:19 +02:00
Родитель 7a95d0279e
Коммит 53f094a1dd
2 изменённых файлов: 27 добавлений и 16 удалений

Просмотреть файл

@ -92,7 +92,7 @@
<Entry
x:Name="MaximumColorEntry"
Placeholder="Maximum Color"
Text="#ff2b2b"
Text="#FF2B2B"
TextChanged="OnMaximumColorEntryTextChanged"
Style="{StaticResource SettingsEntryStyle}"/>
</StackLayout>
@ -106,7 +106,7 @@
<Entry
x:Name="MinimumColorEntry"
Placeholder="Minimum Color"
Text="#07a649"
Text="#07A649"
TextChanged="OnMinimumColorEntryTextChanged"
Style="{StaticResource SettingsEntryStyle}"/>
</StackLayout>
@ -120,7 +120,7 @@
<Entry
x:Name="MaximumTextColorEntry"
Placeholder="Maximum Text Color"
Text="#000000"
Text="#FFFFFF"
TextChanged="OnMaximumTextColorEntryTextChanged"
Style="{StaticResource SettingsEntryStyle}"/>
</StackLayout>
@ -134,7 +134,7 @@
<Entry
x:Name="MinimumTextColorEntry"
Placeholder="Minimum Text Color"
Text="#ffffff"
Text="#FFFFFF"
TextChanged="OnMinimumTextColorTextChanged"
Style="{StaticResource SettingsEntryStyle}"/>
</StackLayout>

Просмотреть файл

@ -84,19 +84,24 @@
MinusRectangle = new Rect(cX - radius, cY - radius, radius * 2, radius * 2);
canvas.RestoreState();
canvas.RestoreState();
canvas.SaveState();
canvas.SaveState();
canvas.FillColor = Colors.Red;
canvas.FontColor = MinimumTextColor;
const string minusIcon = "M0,0L32,0 32,5.3 0,5.3z";
canvas.FontSize = 24.0f;
var vBuilder = new PathBuilder();
var path = vBuilder.BuildPath(minusIcon).AsScaledPath(0.5f);
canvas.DrawString("-", cX, cY + margin, HorizontalAlignment.Center);
canvas.FillColor = MinimumTextColor;
canvas.RestoreState();
}
Point center = new Point(MinusRectangle.X + MinusRectangle.Width / 2, MinusRectangle.Y + MinusRectangle.Height / 2);
canvas.Translate((float)center.X - path.Bounds.Width / 2, (float)center.Y - path.Bounds.Height / 2);
canvas.FillPath(path);
canvas.RestoreState();
}
void DrawMaximum(ICanvas canvas, RectF dirtyRect)
{
@ -124,13 +129,19 @@
canvas.SaveState();
canvas.FontColor = MaximumTextColor;
const string plusIcon = "M13.55896,0L18.461914,0 18.461914,13.557983 32,13.557983 32,18.481018 18.5,18.481018 18.5,32 13.55896,32 13.55896,18.481018 0,18.481018 0,13.557983 13.55896,13.557983z";
canvas.FontSize = 24.0f;
var vBuilder = new PathBuilder();
var path = vBuilder.BuildPath(plusIcon).AsScaledPath(0.5f);
canvas.DrawString("+", cX, cY + margin, HorizontalAlignment.Center);
canvas.FillColor = MaximumTextColor;
canvas.RestoreState();
Point center = new Point(PlusRectangle.X + PlusRectangle.Width / 2, PlusRectangle.Y + PlusRectangle.Height / 2);
canvas.Translate((float)center.X - path.Bounds.Width / 2, (float)center.Y - path.Bounds.Height / 2);
canvas.FillPath(path);
canvas.RestoreState();
}
void DrawValue(ICanvas canvas, RectF dirtyRect)