55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Drawing;
|
|
|
|
|
|
namespace DrawGraph
|
|
{
|
|
[JsonObject(MemberSerialization.OptOut)]
|
|
[Serializable]
|
|
public class ChartPackObj : PackObjBase
|
|
{
|
|
public ChartPackObj(ZedGraphControl zgc, PackObjManager poManager) : base(zgc, poManager)
|
|
{
|
|
bool flag = zgc == null;
|
|
if (!flag)
|
|
{
|
|
this.baseZed = zgc;
|
|
base.PackText = "图表" + this.index.ToString();
|
|
Chart chart = zgc.GraphPane.Chart;
|
|
chart.Fill = new Fill(Color.White);
|
|
chart.Border.Width = 0f;
|
|
chart.Border.IsVisible = false;
|
|
chart.IsRectAuto = true;
|
|
float x = base.RealX * (float)zgc.Width;
|
|
float y = base.RealY * (float)zgc.Height;
|
|
float width = (base.RealEndX - base.RealX) * (float)zgc.Width;
|
|
float height = (base.RealEndY - base.RealY) * (float)zgc.Height;
|
|
chart.Rect = new RectangleF(x, y, width, height);
|
|
}
|
|
}
|
|
|
|
public override void Draw()
|
|
{
|
|
bool flag = this.baseZed == null;
|
|
if (!flag)
|
|
{
|
|
float x = base.RealX * (float)this.baseZed.Width;
|
|
float y = base.RealY * (float)this.baseZed.Height;
|
|
float width = (base.RealEndX - base.RealX) * (float)this.baseZed.Width;
|
|
float height = (base.RealEndY - base.RealY) * (float)this.baseZed.Height;
|
|
Chart chart = this.baseZed.GraphPane.Chart;
|
|
chart.Rect = new RectangleF(x, y, width, height);
|
|
base.Refresh();
|
|
}
|
|
}
|
|
|
|
public override void Clear()
|
|
{
|
|
Chart chart = this.baseZed.GraphPane.Chart;
|
|
chart.Rect = new RectangleF(0f, 0f, 0f, 0f);
|
|
base.Refresh();
|
|
}
|
|
}
|
|
}
|