157 lines
3.4 KiB
C#
157 lines
3.4 KiB
C#
|
|
using DrawGraph;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Drawing;
|
|
|
|
|
|
namespace DrawGraph
|
|
{
|
|
[JsonObject(MemberSerialization.OptOut)]
|
|
[Serializable]
|
|
public class TablePackObj : PackObjBase
|
|
{
|
|
private Color frameColor = Color.Black;
|
|
|
|
public uint columns = 1u;
|
|
|
|
public uint rows = 1u;
|
|
|
|
private int lineWidth = 1;
|
|
|
|
public uint Rows
|
|
{
|
|
get
|
|
{
|
|
return this.rows;
|
|
}
|
|
set
|
|
{
|
|
this.rows = value;
|
|
}
|
|
}
|
|
|
|
public uint Columns
|
|
{
|
|
get
|
|
{
|
|
return this.columns;
|
|
}
|
|
set
|
|
{
|
|
this.columns = value;
|
|
}
|
|
}
|
|
|
|
public Color FrameColor
|
|
{
|
|
get
|
|
{
|
|
return this.frameColor;
|
|
}
|
|
set
|
|
{
|
|
this.frameColor = value;
|
|
}
|
|
}
|
|
|
|
[ClassAttributs(Description = "线粗细")]
|
|
public int LineWidth
|
|
{
|
|
get
|
|
{
|
|
return this.lineWidth;
|
|
}
|
|
set
|
|
{
|
|
this.lineWidth = value;
|
|
}
|
|
}
|
|
|
|
public TablePackObj(ZedGraphControl zgc, PackObjManager poManager) : base(zgc, poManager)
|
|
{
|
|
this.baseZed = zgc;
|
|
base.PackText = "表格" + this.index.ToString();
|
|
}
|
|
|
|
public override void Draw()
|
|
{
|
|
bool flag = this.baseZed == null;
|
|
if (!flag)
|
|
{
|
|
this.Clear();
|
|
bool flag2 = base.RealEndX <= base.RealX || base.RealEndY <= base.RealY;
|
|
if (!flag2)
|
|
{
|
|
float num = base.RealEndX - base.RealX;
|
|
float num2 = base.RealEndY - base.RealY;
|
|
BoxObj boxObj = new BoxObj((double)base.RealX, (double)base.RealY, (double)num, (double)num2);
|
|
boxObj.Tag = base.PackTag;
|
|
boxObj.Location.CoordinateFrame = CoordType.PaneFraction;
|
|
boxObj.Border.IsVisible = true;
|
|
bool isSelect = base.IsSelect;
|
|
if (isSelect)
|
|
{
|
|
boxObj.Border.Width = (float)this.LineWidth;
|
|
boxObj.Border.Color = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
boxObj.Border.Color = this.frameColor;
|
|
}
|
|
boxObj.Fill.IsVisible = false;
|
|
boxObj.ZOrder = ZOrder.B_BehindLegend;
|
|
ZUtil.DrawBox(boxObj, this.baseZed);
|
|
int num3 = 1;
|
|
while ((long)num3 < (long)((ulong)this.rows))
|
|
{
|
|
float num4 = base.RealY + (float)num3 * ((base.RealEndY - base.RealY) / this.rows);
|
|
ZUtil.DrawLine((double)base.RealX, (double)num4, (double)base.RealEndX, (double)num4, this.baseZed, base.PackTag + "-" + num3.ToString(), boxObj.Border.Color);
|
|
num3++;
|
|
}
|
|
int num5 = 1;
|
|
while ((long)num5 < (long)((ulong)this.columns))
|
|
{
|
|
float num6 = base.RealX + (float)num5 * ((base.RealEndX - base.RealX) / this.columns);
|
|
ZUtil.DrawLine((double)num6, (double)base.RealY, (double)num6, (double)base.RealEndY, this.baseZed, base.PackTag + "-" + num5.ToString(), boxObj.Border.Color);
|
|
num5++;
|
|
}
|
|
base.Refresh();
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void Clear()
|
|
{
|
|
GraphObj graphObj = this.baseZed.MasterPane.GraphObjList[base.PackTag];
|
|
bool flag = graphObj != null;
|
|
if (flag)
|
|
{
|
|
this.baseZed.MasterPane.GraphObjList.Remove(graphObj);
|
|
}
|
|
int num = 1;
|
|
while ((long)num < (long)((ulong)this.rows))
|
|
{
|
|
graphObj = this.baseZed.MasterPane.GraphObjList[base.PackTag + "-" + num.ToString()];
|
|
bool flag2 = graphObj != null;
|
|
if (flag2)
|
|
{
|
|
this.baseZed.MasterPane.GraphObjList.Remove(graphObj);
|
|
}
|
|
num++;
|
|
}
|
|
int num2 = 1;
|
|
while ((long)num2 < (long)((ulong)this.columns))
|
|
{
|
|
graphObj = this.baseZed.MasterPane.GraphObjList[base.PackTag + "-" + num2.ToString()];
|
|
bool flag3 = graphObj != null;
|
|
if (flag3)
|
|
{
|
|
this.baseZed.MasterPane.GraphObjList.Remove(graphObj);
|
|
}
|
|
num2++;
|
|
}
|
|
}
|
|
}
|
|
}
|