using System; using Gtk; public class MyWindow : Window { private static Label l; public MyWindow () : base ("My New Window") { VBox v = new VBox(); this.SetDefaultSize (500, 250); this.BorderWidth = 15; this.DeleteEvent += new DeleteEventHandler (OnMyWindowDelete); this.Add (v); v.Spacing = 6; l = new Label ("New Application"); v.PackStart (l, true, false, 0); Button b1 = new Button ("Click Me"); b1.Clicked += new EventHandler (OnButton1Clicked); v.PackStart (b1, false, false, 0); Button b2 = new Button ("Push me! to resize."); b2.Clicked += new EventHandler (OnButton2Clicked); v.PackStart (b2, false, false, 0); this.ShowAll (); } void OnMyWindowDelete (object o, DeleteEventArgs args) { Application.Quit (); } void OnButton1Clicked (object o, EventArgs args) { l.Text = "Button 1 Clicked"; } void OnButton2Clicked (object o, EventArgs args) { l.Text = "2nd Button Clicked"; this.Resize (1,1); } }