using System; using System.IO; using System.Reflection; using System.Runtime.InteropServices; using Cairo; using Gtk; public class Example { static void Main () { Application.Init (); Gtk.Window w = new Gtk.Window ("Перетворення Mono-Cairo"); w.Resize (400, 400); DrawingArea a = new CairoGraphic (); Box box = new HBox (true, 0); box.Add (a); w.Add (box); w.DeleteEvent += close_window; w.ShowAll (); Application.Run (); } static void close_window (object obj, DeleteEventArgs args) { Application.Quit (); } } public class CairoGraphic : DrawingArea { protected override bool OnExposeEvent (Gdk.EventExpose args) { using (Context g = Gdk.CairoHelper.Create (args.Window)) { g.Rectangle (160, 20, 140, 80); g.Rotate (Math.PI/6); g.Rectangle (160, 20, 140, 80); g.Translate (0, 100); g.Rectangle (160, 20, 140, 80); g.Scale(2,2); g.Rectangle (160, 20, 140, 80); g.SetSourceColor(new Color (0, 1, 0, 1)); g.FillPreserve (); g.SetSourceColor(new Color (0, 0, 1, 0.5)); g.LineWidth = 7; g.Stroke(); } return true; } }