using System; using Cairo; using Gdk; using Gtk; class Area : DrawingArea { protected override bool OnDrawn(Context cr) // малювання { cr.LineWidth = 1.0; int w = Allocation.Width, h = Allocation.Height; cr.Translate(w / 2, h / 2); cr.Arc(0, 0, 120, 0, 2 * Math.PI); cr.Stroke(); cr.Save(); for (int i = 0; i < 36; i++) { cr.Rotate(i * Math.PI / 36); cr.Scale(0.3, 1); cr.Arc(0, 0, 120, 0, 2 * Math.PI); cr.Restore(); cr.Stroke(); cr.Save(); } return true; } } class OwnWindow : Gtk.Window // клас вікна застосунку { public OwnWindow() : base("Еліпси") { Resize(250, 250); Add(new Area()); // додавання області малювання } protected override bool OnDeleteEvent(Event e) { Application.Quit(); return true; } } class Example { static void Main() { Application.Init(); OwnWindow w = new OwnWindow(); w.ShowAll(); Application.Run(); } }