示例#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 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();
     }
 }
示例#3
0
        public List <AnnObject> GetAnnObjects(int frameIndex)
        {
            var annObjects = AnnObjectContainer.Where(a => a.FrameIndex == frameIndex);

            return(AnnObjectContainer.ToList());
        }