using Newtonsoft.Json; using System; using System.Drawing; namespace DrawGraph { [JsonObject(MemberSerialization.OptOut)] [Serializable] public class AbandonTablePackObj : PackObjBase { private float endX = 0f; private float endY = 0f; private Color frameColor = Color.Black; public uint columns = 1u; public uint rows = 1u; 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; } } public new float EndY { get { return this.endY; } set { this.endY = value; } } public new float EndX { get { return this.endX; } set { this.endX = value; } } [JsonIgnore] private new float RealEndY { get { float num = 0f; bool flag = base.SetParent != null; if (flag) { num = base.SetParent.Y; } return this.poManager.Y + num + this.EndY; } } [JsonIgnore] private new float RealEndX { get { float num = 0f; bool flag = base.SetParent != null; if (flag) { num = base.SetParent.X; } return this.poManager.X + num + this.EndX; } } [JsonIgnore] private float RealStartY { get { float num = 0f; bool flag = base.SetParent != null; if (flag) { num = base.SetParent.Y; } return this.poManager.Y + num + base.Y; } } [JsonIgnore] private float RealStartX { get { float num = 0f; bool flag = base.SetParent != null; if (flag) { num = base.SetParent.X; } return this.poManager.X + num + base.X; } } public AbandonTablePackObj(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 = this.RealEndX <= this.RealStartX || this.RealEndY <= this.RealStartY; if (!flag2) { float num = this.RealEndX - this.RealStartX; float num2 = this.RealEndY - this.RealStartY; BoxObj boxObj = new BoxObj((double)this.RealStartX, (double)this.RealStartY, (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 = 1f; 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 = this.RealStartY + (float)num3 * ((this.RealEndY - this.RealStartY) / this.rows); ZUtil.DrawLine((double)this.RealStartX, (double)num4, (double)this.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 = this.RealStartX + (float)num5 * ((this.RealEndX - this.RealStartX) / this.columns); ZUtil.DrawLine((double)num6, (double)this.RealStartY, (double)num6, (double)this.RealEndY, this.baseZed, base.PackTag + "-" + num5.ToString(), boxObj.Border.Color); num5++; } int num7 = 0; while ((long)num7 < (long)((ulong)this.rows)) { int num8 = 0; while ((long)num8 < (long)((ulong)this.columns)) { float num9 = this.RealStartX + (float)num8 * ((this.RealEndX - this.RealStartX) / this.columns); float num10 = this.RealStartY + (float)(num7 + 1) * ((this.RealEndY - this.RealStartY) / this.rows); float num11 = this.RealStartX + (float)(num8 + 1) * ((this.RealEndX - this.RealStartX) / this.columns); float num12 = this.RealStartY + (float)num7 * ((this.RealEndY - this.RealStartY) / this.rows); ZUtil.DrawLine((double)num9, (double)num10, (double)num11, (double)num12, this.baseZed, base.PackTag + "-" + ((num7 + 1) * (num8 + 1)).ToString(), boxObj.Border.Color); num8++; } num7++; } 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++; } int num3 = 0; while ((long)num3 < (long)((ulong)this.rows)) { int num4 = 0; while ((long)num4 < (long)((ulong)this.columns)) { graphObj = this.baseZed.MasterPane.GraphObjList[base.PackTag + "-" + ((num3 + 1) * (num4 + 1)).ToString()]; bool flag4 = graphObj != null; if (flag4) { this.baseZed.MasterPane.GraphObjList.Remove(graphObj); } num4++; } num3++; } } } }