Exemplo n.º 1
0
 public override void Selected()
 {
     if (!Select)
     {
         Point pForRect3 = new Point();
         pForRect3.X = Math.Min(coordinates[0].X, coordinates[1].X);
         pForRect3.Y = Math.Min(coordinates[0].Y, coordinates[1].Y);
         Point pForRect4 = new Point();
         pForRect4.X = Math.Max(coordinates[0].X, coordinates[1].X);
         pForRect4.Y = Math.Max(coordinates[0].Y, coordinates[1].Y);
         SelectRect  = new ZoomRectangle(new Point(pForRect3.X - 15, pForRect3.Y - 15), new Point(pForRect4.X + 15, pForRect4.Y + 15));
         var drawingVisual  = new DrawingVisual();
         var drawingContext = drawingVisual.RenderOpen();
         SelectRect.Draw(drawingContext);
         drawingContext.Close();
         NotArtist.FigureHost.Children.Add(drawingVisual);
         Select = true;
     }
 }
Exemplo n.º 2
0
        public override void Selected()
        {
            if (!Select)
            {
                Point pForRect3 = coordinates[0];
                Point pForRect4 = new Point(0, 0);
                foreach (Point aPoint in coordinates)
                {
                    if (aPoint.X < pForRect3.X)
                    {
                        pForRect3.X = aPoint.X;
                    }

                    if (aPoint.Y < pForRect3.Y)
                    {
                        pForRect3.Y = aPoint.Y;
                    }

                    if (aPoint.X > pForRect4.X)
                    {
                        pForRect4.X = aPoint.X;
                    }

                    if (aPoint.Y > pForRect4.Y)
                    {
                        pForRect4.Y = aPoint.Y;
                    }
                }
                SelectRect = new ZoomRectangle(new Point(pForRect3.X - 7, pForRect3.Y - 7), new Point(pForRect4.X + 7, pForRect4.Y + 7));
                var drawingVisual  = new DrawingVisual();
                var drawingContext = drawingVisual.RenderOpen();
                SelectRect.Draw(drawingContext);
                drawingContext.Close();
                NotArtist.FigureHost.Children.Add(drawingVisual);
                Select = true;
            }
        }