I am drawing shapes on a canvas in wpf in visual studio. What is the (best) way to “add” two small circles on the inner right side of a Rectangle? I want them to seem to the user as “small holes” on the Rectangle. Should I get the coordinates of the right side of the Rectangle and by computing the respective demanded coordinates of the circles’ centers (I want them to be above and below of the middle of the rectangle symmetrically) to draw the circles? Is Canvas GetRight the appropriate method to get the coordinates of the right side of the Rectangle? How I apply it on the code:
shapeToRender = new Rectangle() { Fill = Brushes.Red, Height = 50, Width = 50, RadiusX = 10, RadiusY = 10 };
Canvas.SetLeft(shapeToRender, e.GetPosition(canvasDrawingArea).X - rectWidth / 2);
Canvas.SetTop(shapeToRender, e.GetPosition(canvasDrawingArea).Y - rectHeight / 2);
canvasDrawingArea.Children.Add(shapeToRender);
The shapes are created by a MouseEnter event.