static void Main() { Square sq = new Square(50); sq.X = 10; sq.Y = 20; sq.Draw(); Rectangle rec = new Rectangle(20, 30); rec.Coordinates(15, 18); rec.Draw(); Circle c = new Circle(); c.Coordinates(25, 35); c.Width = 20; c.Draw(); Ellipse e = new Ellipse(); e.Coordinates(35, 45); e.Height = 30; e.Width = 20; e.Draw(); // Textbox - with text content TextBox t1 = new TextBox("test content"); t1.Coordinates(20, 30); t1.Height = 30; t1.Width = 40; t1.Colour = "Green"; t1.Draw(); // Textbox - no text content TextBox t2 = new TextBox(); t2.Coordinates(10, 20); t2.Height = 20; t2.Width = 30; t2.Draw(); Console.ReadLine(); }
/// <summary> /// Draw a square, by capturing 2 clicks to define two oposite diagonal points. /// </summary> /// <param name="e"></param> private void CreateSquare(MouseEventArgs e) { if (clicknumber == 0) { one = new PointF(e.X, e.Y); clicknumber = 1; } else { two = new PointF(e.X, e.Y); clicknumber = 0; Graphics g = this.CreateGraphics(); Square aShape = new Square(one, two); activeShapes.Add(aShape); aShape.Draw(g); } RefreshDrawings(); }