* UILedBulb:更新绘制平滑
This commit is contained in:
parent
abe882329c
commit
b39c27753e
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
BIN
Bin/SunnyUI.pdb
BIN
Bin/SunnyUI.pdb
Binary file not shown.
Binary file not shown.
@ -91,4 +91,34 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class UILiveChartStyle:UIChartStyle
|
||||||
|
{
|
||||||
|
public override Color BackColor => Color.FromArgb(16, 36, 71);
|
||||||
|
|
||||||
|
public override Color ForeColor => Color.FromArgb(170, 170, 170);
|
||||||
|
|
||||||
|
public override Color ToolTipShadowColor => Color.FromArgb(81, 81, 81);
|
||||||
|
|
||||||
|
public override Color[] SeriesColor
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
Color.FromArgb(33, 149, 242),
|
||||||
|
Color.FromArgb(254, 192, 7),
|
||||||
|
Color.FromArgb(243, 67, 54),
|
||||||
|
Color.FromArgb(96, 125, 138),
|
||||||
|
Color.FromArgb(0,187,211),
|
||||||
|
Color.FromArgb(232,30,99),
|
||||||
|
Color.FromArgb(254,87,34),
|
||||||
|
Color.FromArgb(63,81,180),
|
||||||
|
Color.FromArgb(204,219,57),
|
||||||
|
Color.FromArgb(0,149,135),
|
||||||
|
Color.FromArgb(255,154,59)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -123,7 +123,8 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
Default,
|
Default,
|
||||||
Plain,
|
Plain,
|
||||||
Dark
|
Dark,
|
||||||
|
LiveChart
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class UIChartStyles
|
public static class UIChartStyles
|
||||||
@ -134,10 +135,13 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
public static UIChartStyle Dark = new UIDarkChartStyle();
|
public static UIChartStyle Dark = new UIDarkChartStyle();
|
||||||
|
|
||||||
|
public static UIChartStyle LiveChart = new UILiveChartStyle();
|
||||||
|
|
||||||
public static UIChartStyle GetChartStyle(UIChartStyleType style)
|
public static UIChartStyle GetChartStyle(UIChartStyleType style)
|
||||||
{
|
{
|
||||||
if (style == UIChartStyleType.Default) return Default;
|
if (style == UIChartStyleType.Default) return Default;
|
||||||
if (style == UIChartStyleType.Dark) return Dark;
|
if (style == UIChartStyleType.Dark) return Dark;
|
||||||
|
if (style == UIChartStyleType.LiveChart) return LiveChart;
|
||||||
return Plain;
|
return Plain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ namespace Sunny.UI
|
|||||||
Bitmap offScreenBmp = new Bitmap(ClientRectangle.Width, ClientRectangle.Height);
|
Bitmap offScreenBmp = new Bitmap(ClientRectangle.Width, ClientRectangle.Height);
|
||||||
using (var g = Graphics.FromImage(offScreenBmp))
|
using (var g = Graphics.FromImage(offScreenBmp))
|
||||||
{
|
{
|
||||||
g.SmoothingMode = SmoothingMode.HighQuality;
|
g.SetHighQuality();
|
||||||
// Draw the control
|
// Draw the control
|
||||||
drawControl(g, On);
|
drawControl(g, On);
|
||||||
// Draw the image to the screen
|
// Draw the image to the screen
|
||||||
@ -129,7 +129,7 @@ namespace Sunny.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void drawControl(Graphics g, bool on)
|
private void drawControl(Graphics g, bool on)
|
||||||
{
|
{
|
||||||
// Is the bulb on or off
|
// Is the bulb on or off
|
||||||
Color lightColor = (on) ? Color : Color.FromArgb(150, DarkColor);
|
Color lightColor = (on) ? Color : Color.FromArgb(150, DarkColor);
|
||||||
Color darkColor = (on) ? DarkColor : DarkDarkColor;
|
Color darkColor = (on) ? DarkColor : DarkDarkColor;
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
// Draw the background ellipse
|
// Draw the background ellipse
|
||||||
var rectangle = new Rectangle(Padding.Left, Padding.Top, diameter, diameter);
|
var rectangle = new Rectangle(Padding.Left, Padding.Top, diameter, diameter);
|
||||||
g.FillEllipse(darkColor, rectangle);
|
g.FillEllipse(darkColor, rectangle,true);
|
||||||
|
|
||||||
// Draw the glow gradient
|
// Draw the glow gradient
|
||||||
var path = new GraphicsPath();
|
var path = new GraphicsPath();
|
||||||
@ -151,6 +151,7 @@ namespace Sunny.UI
|
|||||||
var pathBrush = new PathGradientBrush(path);
|
var pathBrush = new PathGradientBrush(path);
|
||||||
pathBrush.CenterColor = lightColor;
|
pathBrush.CenterColor = lightColor;
|
||||||
pathBrush.SurroundColors = new[] { Color.FromArgb(0, lightColor) };
|
pathBrush.SurroundColors = new[] { Color.FromArgb(0, lightColor) };
|
||||||
|
g.SetHighQuality();
|
||||||
g.FillEllipse(pathBrush, rectangle);
|
g.FillEllipse(pathBrush, rectangle);
|
||||||
pathBrush.Dispose();
|
pathBrush.Dispose();
|
||||||
|
|
||||||
@ -163,6 +164,7 @@ namespace Sunny.UI
|
|||||||
var pathBrush1 = new PathGradientBrush(path);
|
var pathBrush1 = new PathGradientBrush(path);
|
||||||
pathBrush1.CenterColor = _reflectionColor;
|
pathBrush1.CenterColor = _reflectionColor;
|
||||||
pathBrush1.SurroundColors = _surroundColor;
|
pathBrush1.SurroundColors = _surroundColor;
|
||||||
|
g.SetHighQuality();
|
||||||
g.FillEllipse(pathBrush1, whiteRect);
|
g.FillEllipse(pathBrush1, whiteRect);
|
||||||
pathBrush1.Dispose();
|
pathBrush1.Dispose();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user