* UILineChart: 支持FillColor透明

This commit is contained in:
Sunny 2022-01-06 10:54:44 +08:00
parent 0c7a944132
commit 599acadacd
3 changed files with 23 additions and 15 deletions

Binary file not shown.

Binary file not shown.

View File

@ -28,6 +28,7 @@
* 2021-12-31: V3.0.9 线线 * 2021-12-31: V3.0.9 线线
* 2021-12-31: V3.0.9 * 2021-12-31: V3.0.9
* 2021-12-31: V3.0.9 X轴支持字符串显示 * 2021-12-31: V3.0.9 X轴支持字符串显示
* 2022-01-06: V3.1.0 FillColor透明
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -474,20 +475,23 @@ namespace Sunny.UI
{ {
if (YScale == null) return; if (YScale == null) return;
using (Graphics graphics = bmp.Graphics()) bmp?.Dispose();
{ bmp = new Bitmap(Width, Height);
graphics.FillRectangle(FillColor, 0, 0, Width, Height);
}
using (Graphics graphics = bmpGreater.Graphics()) //using (Graphics graphics = bmp.Graphics())
{ //{
graphics.FillRectangle(FillColor, 0, 0, Width, Height); // graphics.FillRectangle(FillColor, 0, 0, Width, Height);
} //}
//
using (Graphics graphics = bmpLess.Graphics()) //using (Graphics graphics = bmpGreater.Graphics())
{ //{
graphics.FillRectangle(FillColor, 0, 0, Width, Height); // graphics.FillRectangle(FillColor, 0, 0, Width, Height);
} //}
//
//using (Graphics graphics = bmpLess.Graphics())
//{
// graphics.FillRectangle(FillColor, 0, 0, Width, Height);
//}
int idx = 0; int idx = 0;
float wTop = Option.Grid.Top; float wTop = Option.Grid.Top;
@ -511,6 +515,12 @@ namespace Sunny.UI
} }
else else
{ {
bmpGreater?.Dispose();
bmpGreater = new Bitmap(Width, Height);
bmpLess?.Dispose();
bmpLess = new Bitmap(Width, Height);
foreach (var series in Option.Series.Values) foreach (var series in Option.Series.Values)
{ {
Color color = series.Color; Color color = series.Color;
@ -571,8 +581,6 @@ namespace Sunny.UI
g.DrawImage(bmp, new Rectangle((int)wLeft, (int)wTop, (int)(wRight - wLeft), (int)(wBottom - wTop)), g.DrawImage(bmp, new Rectangle((int)wLeft, (int)wTop, (int)(wRight - wLeft), (int)(wBottom - wTop)),
new Rectangle((int)wLeft, (int)wTop, (int)(wRight - wLeft), (int)(wBottom - wTop)), GraphicsUnit.Pixel); new Rectangle((int)wLeft, (int)wTop, (int)(wRight - wLeft), (int)(wBottom - wTop)), GraphicsUnit.Pixel);
} }
private void DrawPointSymbols(Graphics g) private void DrawPointSymbols(Graphics g)