Simple.cs (737B)
1 // taken from the gtk# samples 2 namespace MyApp 3 { 4 using Gtk; 5 using System; 6 7 public class Simple 8 { 9 10 public static int Main(string[] args) 11 { 12 Application.Init(); 13 Window win = new Window("Simple gtk# app"); 14 win.DefaultWidth = 300; 15 win.DefaultHeight = 300; 16 win.DeleteEvent += new DeleteEventHandler(Window_Delete); 17 Button btn = new Button("Simple button"); 18 btn.Clicked += new EventHandler(print_line); 19 win.Add(btn); 20 win.ShowAll(); 21 Application.Run(); 22 return 0; 23 } 24 25 static void print_line(object obj, EventArgs args) 26 { 27 Console.WriteLine("Simple button was clicked!"); 28 } 29 30 static void Window_Delete(object obj, DeleteEventArgs args) 31 { 32 Application.Quit(); 33 args.RetVal = true; 34 } 35 } 36 } 37