Exemplo n.º 1
0
        public SimpleShape CreateShape(ShapeType shapeType, Point position)
        {
            SimpleShape shape = null;

            switch (shapeType)
            {
            case ShapeType.Rectangle:
                shape = new SimpleRectangle()
                {
                    FillBrush   = Brushes.Blue,
                    StrokeBrush = Brushes.DarkBlue
                };
                break;

            case ShapeType.Ellipse:
                shape = new SimpleEllipse()
                {
                    FillBrush   = Brushes.Red,
                    StrokeBrush = Brushes.DarkRed
                };
                break;

            default:
                throw new ArgumentException("Invalid shape mode to create a shape");
            }

            shape.Width  = 100;
            shape.Height = 50;
            shape.Left   = position.X - shape.Width / 2;
            shape.Top    = position.Y - shape.Height / 2;

            return(shape);
        }
Exemplo n.º 2
0
        public ReplaceMainWindow()
        {
            Title = "Render the graphic";

            SimpleEllipse elips = new SimpleEllipse();

            Content = elips;
        }
Exemplo n.º 3
0
            public UIElement Create(Rect rect)
            {
                SimpleEllipse shape = new SimpleEllipse();

                shape.Width      = rect.Width;
                shape.Height     = rect.Height;
                shape.Background = Brushes.LemonChiffon;
                Canvas.SetLeft(shape, rect.X);
                Canvas.SetTop(shape, rect.Y);
                shape.Text = "The shadow effect is a killer and a software rendering process unless you are running Vista. You can use the font formatting toolbar buttons to change the appearance of this text. There are so many possibilities, this box is just too small to highlight it all.";
                return(shape);
            }