Пример #1
0
        private void DrawFigure(IAbstractFactory factory)
        {
            Figure.ICircle circle = factory.CreateCircle();
            Figure.ISquare square = factory.CreateSquare();

            SolidBrush brush = new SolidBrush(square.GetSqureColor());

            g.FillRectangle(brush, new Rectangle(100, 100, square.GetSideSize(), square.GetSideSize()));
            g.FillEllipse(brush, new Rectangle(250, 100, circle.GetRadius() * 2, circle.GetRadius() * 2));
            brush.Dispose();
        }
Пример #2
0
        private void DrawFigure(IAbstractFactory factory)
        {
            Figure.ICircle  circle = factory.CreateCircle();
            Figure.ISquare  square = factory.CreateSquare();
            SolidColorBrush brush  = new SolidColorBrush(square.GetSqureColor());
            Rectangle       rect   = new Rectangle()
            {
                Fill = brush, Height = square.GetSideSize(), Width = square.GetSideSize()
            };
            Ellipse el = new Ellipse()
            {
                Fill = brush, Height = circle.GetRadius() * 2, Width = circle.GetRadius() * 2
            };

            Canvas.SetLeft(rect, 10);
            Canvas.SetTop(rect, y);
            canvas.Children.Add(rect);
            Canvas.SetLeft(el, 80);
            Canvas.SetTop(el, y);
            canvas.Children.Add(el);
            y += rect.Height + 5;
        }