/// <summary> /// Adds a predefined shape /// </summary> /// <param name="type"></param> /// <param name="location"></param> public ShapeBase AddShape(ShapeTypes type, Point location) { ShapeBase shape = null; switch (type) { case ShapeTypes.Rectangular: shape = new SimpleRectangle(this); break; case ShapeTypes.Oval: shape = new OvalShape(this); break; case ShapeTypes.TextLabel: shape = new TextLabel(this); shape.Location = location; shape.ShapeColor = Color.Transparent; shape.Text = "A text label (change the text in the property grid)"; shape.Width = 350; shape.Height = 30; Shapes.Add(shape); return(shape); } if (shape == null) { return(null); } shape.ShapeColor = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255)); shape.Location = location; Shapes.Add(shape); return(shape); }
/// <summary> /// Adds a predefined shape /// </summary> /// <param name="type"></param> /// <param name="location"></param> public ShapeBase AddShape(ShapeTypes type, Point location) { ShapeBase shape = null; switch(type) { case ShapeTypes.Rectangular: shape = new SimpleRectangle(this); break; case ShapeTypes.Oval: shape = new OvalShape(this); break; case ShapeTypes.TextLabel: shape = new TextLabel(this); shape.Location = location; shape.ShapeColor = Color.Transparent; shape.Text = "A text label (change the text in the property grid)"; shape.Width = 350; shape.Height = 30; Shapes.Add(shape); return shape; } if(shape==null) return null; shape.ShapeColor = Color.FromArgb(rnd.Next(0,255),rnd.Next(0,255),rnd.Next(0,255)); shape.Location = location; Shapes.Add(shape); return shape; }