85 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			85 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 
 | |
| using DrawGraph;
 | |
| using Newtonsoft.Json;
 | |
| using System;
 | |
| using System.Drawing;
 | |
| 
 | |
| 
 | |
| namespace DrawGraph
 | |
| {
 | |
| 	[JsonObject(MemberSerialization.OptOut)]
 | |
| 	[Serializable]
 | |
| 	public class BoxPackObj : PackObjBase
 | |
| 	{
 | |
| 		private Color fillColor = Color.Yellow;
 | |
| 
 | |
| 		private int lineWidth = 1;
 | |
| 
 | |
| 		public Color FillColor
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				return this.fillColor;
 | |
| 			}
 | |
| 			set
 | |
| 			{
 | |
| 				this.fillColor = value;
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		[ClassAttributs(Description = "线粗细")]
 | |
| 		public int LineWidth
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				return this.lineWidth;
 | |
| 			}
 | |
| 			set
 | |
| 			{
 | |
| 				this.lineWidth = value;
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		public BoxPackObj(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 = false;
 | |
| 					bool isSelect = base.IsSelect;
 | |
| 					if (isSelect)
 | |
| 					{
 | |
| 						boxObj.Border.Width = (float)this.LineWidth;
 | |
| 						boxObj.Border.IsVisible = true;
 | |
| 						boxObj.Border.Color = Color.Red;
 | |
| 					}
 | |
| 					else
 | |
| 					{
 | |
| 						boxObj.Border.IsVisible = false;
 | |
| 					}
 | |
| 					boxObj.Fill.IsVisible = true;
 | |
| 					boxObj.Fill.Color = this.FillColor;
 | |
| 					boxObj.ZOrder = ZOrder.B_BehindLegend;
 | |
| 					ZUtil.DrawBox(boxObj, this.baseZed);
 | |
| 					base.Refresh();
 | |
| 				}
 | |
| 			}
 | |
| 		}
 | |
| 	}
 | |
| }
 |