示例#1
0
        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();
        }
示例#2
0
 public DicomImageBox()
 {
     this.DoubleBuffered         = true;
     this.ResizeRedraw           = true;
     AnnObjectContainer          = new AnnObjectContainer();
     AnnObjectContainer.OnAdded += OnAdded;
 }
示例#3
0
        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();
        }
示例#4
0
        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();
        }
示例#5
0
 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();
     }
 }
示例#6
0
        public List <AnnObject> GetAnnObjects(int frameIndex)
        {
            var annObjects = AnnObjectContainer.Where(a => a.FrameIndex == frameIndex);

            return(AnnObjectContainer.ToList());
        }
示例#7
0
 public DicomImageBox()
 {
     //this.DoubleBuffered = true;
     this.ResizeRedraw  = true;
     AnnObjectContainer = new AnnObjectContainer();
 }
示例#8
0
 protected override void OnResize(EventArgs e)
 {
     AnnObjectContainer.ForEach(a => a.Scale = CurrentScale);
     base.OnResize(e);
 }