using System; using System.Collections.Generic; using System.Linq; using System.Text; using DrawGraph; using System.Drawing; namespace DrawGraph { public class SelectedAreaObj : EventObj { //以下两个是物理点 private PhysioData startPD = null; private PhysioData endPd = null; private List startPDs = null; private List endPds = null; //以下两个是控件上的点 private PointF startPoint = new PointF(); private PointF endPoint = new PointF(); private float width = 0; private float height = 0; private string tagName = TextPrefix.BT.ToString(); private bool selected = false; /// /// 选中框是否在选中状态 /// public bool Selected { get { return selected; } set { selected = value; } } /// /// 设置开始的物理点 /// public PhysioData StartPD { get { return startPD; } set { startPD = value; startPoint.X = (float)(getXPositinByXDate(startPD.RecordTime)); startPoint.Y = (float)(getYPositinByValue(startPD.Y, 240, 200, 20)); } } /// /// 设置结束的物理点 /// public PhysioData EndPd { get { return endPd; } set { endPd = value; endPoint.X = (float)(getXPositinByXDate(endPd.RecordTime)); endPoint.Y = (float)(getYPositinByValue(endPd.Y, 240, 200, 20)); width = endPoint.X - startPoint.X; height = endPoint.Y - startPoint.Y; } } /// /// 设置开始的物理点 /// public List StartPDs { get { return startPDs; } set { startPDs = value; } } /// /// 设置结束的物理点 /// public List EndPds { get { return endPds; } set { endPds = value; } } private static volatile SelectedAreaObj instance; private SelectedAreaObj() { tagName += this.GetType().FullName.ToString(); } public static SelectedAreaObj GetInstance() { if (null == instance) { instance = new SelectedAreaObj(); } return instance; } public void Draw() { if (zgcAnas == null) { //MessageBox.Show("未传递窗体或传递的不是麻醉单窗体"); return; } //画之前行清空对象 Clear(); if (startPD != null && endPd != null) { //只能正着画; if (endPoint.X <= startPoint.X || endPoint.Y <= startPoint.Y) return; BoxObj box = new BoxObj(startPoint.X, startPoint.Y, width, height); box.Tag = tagName; box.Location.CoordinateFrame = CoordType.PaneFraction; box.Border.IsVisible = true; box.Border.Color = Color.Black; box.Border.Width = 1; box.Fill.IsVisible = false; box.ZOrder = ZOrder.A_InFront; ZUtil.DrawBox(box, zgcAnas); selected = true; } } public void Clear() { selected = false; delLineObj(tagName); } } }