* UINavBar:修正一处小Bug

This commit is contained in:
Sunny 2020-07-16 22:24:39 +08:00
parent f3adc6af6e
commit ec907e54b8
8 changed files with 29 additions and 14 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -55,6 +55,9 @@ namespace Sunny.UI
max = 0;
}
if (!o.YAxis.MaxAuto) max = o.YAxis.Max;
if (!o.YAxis.MinAuto) min = o.YAxis.Min;
if ((max - min).IsZero())
{
max = 100;

View File

@ -77,6 +77,13 @@ namespace Sunny.UI
public UIAxisTick AxisTick = new UIAxisTick();
public UIAxisLabel AxisLabel = new UIAxisLabel();
public bool MaxAuto { get; set; } = true;
public bool MinAuto { get; set; } = true;
public double Max { get; set; } = 100;
public double Min { get; set; } = 0;
}
public class UICategoryAxis : UIAxis
@ -92,8 +99,6 @@ namespace Sunny.UI
{
Data.Clear();
}
}
public class UIAxisLabel

View File

@ -137,18 +137,25 @@ namespace Sunny.UI
double x = Math.Abs(Math.Sin(az * Math.PI / 180));
double y = Math.Abs(Math.Cos(az * Math.PI / 180));
SizeF sf = g.MeasureString(pie.Data[0].Value.ToString("F0"), SubFont);
string name = Option.Legend != null ? Option.Legend.Data[azIndex] + " : " : "";
if (pie.Data[azIndex].Value > 0)
{
string text = name + pie.Data[azIndex].Value.ToString("F0");
SizeF sf = g.MeasureString(text, SubFont);
PointF pf;
int added = 9;
if (az >= 0 && az < 90)
pf = new PointF((float)(DrawCenter(pie).X + RadiusSize(pie) * x + 6), (float)(DrawCenter(pie).Y - RadiusSize(pie) * y - sf.Height - 6));
pf = new PointF((float)(DrawCenter(pie).X + RadiusSize(pie) * x + added), (float)(DrawCenter(pie).Y - RadiusSize(pie) * y - sf.Height - added));
else if (az >= 90 && az < 180)
pf = new PointF((float)(DrawCenter(pie).X + RadiusSize(pie) * x + 6), (float)(DrawCenter(pie).Y + RadiusSize(pie) * y + 6));
pf = new PointF((float)(DrawCenter(pie).X + RadiusSize(pie) * x + added), (float)(DrawCenter(pie).Y + RadiusSize(pie) * y + added));
else if (az >= 180 && az < 270)
pf = new PointF((float)(DrawCenter(pie).X - RadiusSize(pie) * x - 6) - sf.Width, (float)(DrawCenter(pie).Y + RadiusSize(pie) * y + 6));
pf = new PointF((float)(DrawCenter(pie).X - RadiusSize(pie) * x - added) - sf.Width, (float)(DrawCenter(pie).Y + RadiusSize(pie) * y + added));
else
pf = new PointF((float)(DrawCenter(pie).X - RadiusSize(pie) * x - 6) - sf.Width, (float)(DrawCenter(pie).Y - RadiusSize(pie) * y) - sf.Height - 6);
pf = new PointF((float)(DrawCenter(pie).X - RadiusSize(pie) * x - added) - sf.Width, (float)(DrawCenter(pie).Y - RadiusSize(pie) * y) - sf.Height - added);
g.DrawString(pie.Data[azIndex].Value.ToString("F0"), SubFont, color, pf.X, pf.Y);
if (pie.Data[azIndex].Value > 0)
g.DrawString(text, SubFont, color, pf.X, pf.Y);
}
}
}
}

View File

@ -433,7 +433,7 @@ namespace Sunny.UI
return;
}
NavBarMenu.Style = Style;
NavBarMenu.Style = UIStyles.Style;
NavBarMenu.Items.Clear();
foreach (TreeNode node in Nodes[SelectedIndex].Nodes)
{