static void CreateShape(shapes shape) { Console.Write("Length in cm: "); double length = CheckDouble(); Console.Write("Width in cm: "); double width = CheckDouble(); if (shape == shapes.Ellipse) { var ellipse = new Ellipse(length, width); ViewShapeInfo(ellipse); } else if (shape == shapes.Rectangle) { var rectangle = new Rectangle(length, width); ViewShapeInfo(rectangle); Console.WriteLine("Would you like to resize your rectangle? Enter [Y] to do so."); string input = CheckString(); if (input == "Y") { var resizeableRectangle = new ResizeableRectangle(length, width); Console.WriteLine("How many percentage of your rectangle would you like to keep?"); int resizePercentage = CheckPercentage(); resizeableRectangle.Resize(resizePercentage); ViewShapeInfo(resizeableRectangle); } } }
public ShapePopulate(shapes Rectangle, Color borderColor, Color shapeColor, bool rounding, bool colorshape, bool drawborder, int curve, int upperLeftCurve, int upperRightCurve, int downLeftCurve, int downRightCurve) : this(shapes.Rectangle, Color.DeepSkyBlue, Color.Yellow, 2, true, false, true, 10, 10, 10, 10, 10, 3, 90, 0, 90, true) { }
public GMapPoint(PointLatLng p, int size, shapes shapetoDraw, Pen pen) : base(p) { point_ = p; size_ = size; shapeToDraw_ = shapetoDraw; pen_ = pen; }
public void NewFigure() { ClearFigure(); color = RandomColor(); FigureShape = RandomShape(); figure = CreateFigure(); CalculateFigureDementions(4, 4); }
public void NewFigure(FigureTetris fig) { ClearFigure(); color = fig.color; FigureShape = fig.FigureShape; figure = CreateFigure(); CalculateFigureDementions(4, 4); }
public void peri(int val, shapes s1) { if (s1 == 0) { Console.WriteLine("Circumference of the circle is " + 2 * 3.14 * val); } else { Console.WriteLine("Perimeter of the square is " + 4 * val); } }
public static void Main() { shapes[] arrayOfShapes = new shapes[4]; arrayOfShapes[0] = new shapes(); arrayOfShapes[1] = new Triangle(); arrayOfShapes[2] = new Circle(); arrayOfShapes[3] = new Square(); foreach (shapes elements in arrayOfShapes) { elements.IntroToShapes(); } }
// Internal constructor private ShapePopulate(shapes type, Color borderColor, Color shapeColor, int borderWidth, bool Rounding, bool ColorShape, bool drawborder, int Curve, int upperLeftCurve, int upperRightCurve, int downLeftCurve, int downRightCurve, int PolygonSides, int PolygonAngle, float StartAngle, float EndAngle, bool alwaysYes) { ShapeType = type; bordercolor = borderColor; shapecolor = shapeColor; borderwidth = borderWidth; this.sides = PolygonSides; this.startingangle = PolygonAngle; this.startangle = StartAngle; this.endangle = EndAngle; this.pieDraw = alwaysYes; this.rounding = Rounding; this.colorShape = ColorShape; this.upperLeftCurve = upperLeftCurve; this.upperRightCurve = upperRightCurve; this.downLeftCurve = downLeftCurve; this.downRightCurve = downRightCurve; this.drawBorder = drawborder; this.curve = Curve; }
public Graphics GetShapeAlt(PaintEventArgs e, shapes Shape, Rectangle rectangle) { rectangle = new Rectangle((borderwidth / 2), (borderwidth / 2), rectangle.Width - borderwidth - 1, rectangle.Height - borderwidth - 1); Graphics G = e.Graphics; G.SmoothingMode = SmoothingMode.HighQuality; GraphicsPath path = new GraphicsPath(); RoundedRectangleControl(e, path, rectangle); //if (ShapeType == Shape) //{ // RectangleControl(e, rectangle); // return G; //} //if (ShapeType == Shape) //{ // RoundedRectangleControl(e, path, rectangle); // return G; //} //if (ShapeType == Shape) //{ // CircleControl(e, rectangle); // return G; //} //if (ShapeType == Shape) //{ // PieControl(e, rectangle, startangle, endangle); // return G; //} return(null); }
public ShapePopulate(shapes Pie, float StartingAngle, float EndingAngle, bool alwaysYes) : this(shapes.Pie, Color.DeepSkyBlue, Color.Yellow, 2, true, false, true, 10, 10, 10, 10, 10, 3, 90, 0, 90, true) { }
public ShapePopulate(shapes Polygon, int PolygonSides, int PolygonAngle) : this(shapes.Polygon, Color.DeepSkyBlue, Color.Yellow, 2, true, false, true, 10, 10, 10, 10, 10, 3, 90, 0, 90, true) { }
//public ShapePopulate(shapes RoundedRectangle, int upperLeftCurve, int upperRightCurve, // int downLeftCurve, int downRightCurve) : this(shapes.RoundedRectangle, Color.DeepSkyBlue, Color.Yellow, borderwidth) //{ //} public ShapePopulate(shapes Circle, Color borderColor, Color shapeColor, bool colorshape, bool drawborder) : this(shapes.Circle, Color.DeepSkyBlue, Color.Yellow, 2, true, false, true, 10, 10, 10, 10, 10, 3, 90, 0, 90, true) { }
/// <summary> /// Constructor for none fill. /// </summary> public ShapePopulate(shapes None, bool draw) : this(shapes.None, Color.Empty, Color.Empty, 2, true, true, true, 10, 10, 10, 10, 10, 3, 90, 0, 90, true) /* gradientColors */ { }
private void BuildTestObjects() { //status.Text += "creating test objects\n"; // set up array of color objects this.testObjects = new colorObject[TEST_LENGTH]; // define box where objects can appear int minX = 100; int maxX = 400; int minY = 100; int maxY = 400; for (int i = 0; i < TEST_LENGTH; i++) { // Total number of enum elements: http://stackoverflow.com/questions/856154/total-number-of-items-defined-in-an-enum colors color = (colors)random.Next(0, Enum.GetNames(typeof(colors)).Length); // get a random color shapes shape = (shapes)random.Next(0, Enum.GetNames(typeof(shapes)).Length); // get a random shape switch (shape) { case (shapes.circle): testObjects[i].shape = new Ellipse(); break; case (shapes.square): testObjects[i].shape = new Rectangle(); break; case (shapes.triangle): var triangle = new Polygon(); triangle.Points.Add(new Point(55, 30)); triangle.Points.Add(new Point(0, 120)); triangle.Points.Add(new Point(110, 120)); testObjects[i].shape = triangle; break; default: break; } switch (color) { case (colors.red): testObjects[i].shape.Fill = Brushes.Red; break; case (colors.blue): testObjects[i].shape.Fill = Brushes.Blue; break; case (colors.green): testObjects[i].shape.Fill = Brushes.Green; break; default: break; } // TODO: add different sizes testObjects[i].size = 120; testObjects[i].shape.Width = testObjects[i].size; testObjects[i].shape.Height = testObjects[i].size; testObjects[i].center.X = random.Next(minX, maxX); testObjects[i].center.Y = random.Next(minY, maxY); //UIElementExtensions.SetGroupID(testObjects[object_id].shape, 3); Canvas.SetTop(testObjects[i].shape, testObjects[i].center.Y); Canvas.SetLeft(testObjects[i].shape, testObjects[i].center.X); testObjects[i].shape.Stroke = Brushes.Gray; testObjects[i].shape.StrokeThickness = 2; } //status.Text += "test objects created\n"; }