protected override void OnClick(EventArgs e) { bool IsHited(AnnObject annObject, Point point) { var hitedRange = annObject.DrawStartPosition.GetDistance(point) + annObject.DrawEndPosition.GetDistance(point); var lineRange = annObject.DrawStartPosition.GetDistance(annObject.DrawEndPosition); if (hitedRange - lineRange < 3) { return(true); } else { return(false); } } var clickPosition = PointToClient(MousePosition); var currentPageAnnObject = AnnObjectContainer.Where(a => a.FrameIndex == FrameIndex); foreach (var i in currentPageAnnObject) { if (IsHited(i, clickPosition)) { i.IsSelected = true; } else { i.IsSelected = false; } } Invalidate(); }
public DicomImageBox() { this.DoubleBuffered = true; this.ResizeRedraw = true; AnnObjectContainer = new AnnObjectContainer(); AnnObjectContainer.OnAdded += OnAdded; }
public void AddAnnObject(AnnObjectType annObjectType, int frameIndex, Point p1, Point p2) { var annObject = AnnObjectContainer.CreateAnnObject(annObjectType, p1, p2); annObject.FrameIndex = frameIndex; annObject.PenWidth = 2; annObject.Scale = CurrentScale; annObject.Type = annObjectType; AnnObjectContainer.Add(annObject); Invalidate(); }
public void AddAnnObject(AnnObjectType annObjectType, int frameIndex, Point p1, Point p2) { var annObject = AnnObjectContainer.CreateAnnObject(annObjectType, p1, p2); annObject.FrameIndex = frameIndex; annObject.PenWidth = 2; annObject.IsSelected = true; annObject.Type = AnnObjectType.Ruler; AnnObjectContainer.Add(annObject); Invalidate(); }
public void KeyPressed(KeyEventArgs e) { if (e.KeyData == Keys.Delete) { var currentSelected = AnnObjectContainer.Where(a => a.FrameIndex == frameIndex && a.IsSelected); currentSelected.ToList().ForEach(a => { AnnObjectContainer.Remove(a); }); Invalidate(); } }
public List <AnnObject> GetAnnObjects(int frameIndex) { var annObjects = AnnObjectContainer.Where(a => a.FrameIndex == frameIndex); return(AnnObjectContainer.ToList()); }
public DicomImageBox() { //this.DoubleBuffered = true; this.ResizeRedraw = true; AnnObjectContainer = new AnnObjectContainer(); }
protected override void OnResize(EventArgs e) { AnnObjectContainer.ForEach(a => a.Scale = CurrentScale); base.OnResize(e); }