Ejemplo n.º 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))
                {
                    if (CurrentAnnType == AnnObjectType.Eraser)
                    {
                        AnnObjectContainer.Remove(i);
                        break;
                    }
                }
            }
            Invalidate();
        }
Ejemplo n.º 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();
     }
 }