/// <summary> /// Invoked when the Gtk.DrawingArea needs repainting. /// </summary> private void OnExposed() { var p1 = new Polygon( new Point[] { new Point( 10, 10 ), new Point( 100, 100 ), new Point( 150, 10 ) } ); var t1 = new Triangle( new Point( 10, 210 ), new Point( 100, 300 ), new Point( 150, 210 ) ); var r1 = new Rectangle( new Point( 300, 10 ), new Point( 450, 10 ), new Point( 450, 100 ), new Point( 300, 100 ) ); var c1 = new Square( new Point( 300, 210 ), new Point( 400, 300 ) ); using (var canvas = Gdk.CairoHelper.Create( this.drawingArea.GdkWindow )) { canvas.LineWidth = 4; canvas.SetSourceRGBA( 0, 0, 255, 244 ); canvas.LineJoin = Cairo.LineJoin.Miter; this.Paint( canvas, p1 ); this.Paint( canvas, r1 ); this.Paint( canvas, t1 ); this.Paint( canvas, c1 ); canvas.GetTarget().Dispose(); } return; }
/// <summary> /// Initializes a new instance of the <see cref="PolygonsExercise.Core.Figure"/> class. /// Uses a Point[] to define the needed points. The number of points is saved as a future /// requisite (<see cref="NeededPointsForFigure"/>). /// </summary> /// <param name="ps">A Point[] with a given number of Point objects.</param> public Figure(Point[] ps) { this.polygon = new Polygon( ps ); this.NeededPointsForFigure = ps.Length; }