Gtk.HBox hbox = new Gtk.HBox(false, 0); Gtk.Button button1 = new Gtk.Button("Button 1"); Gtk.Button button2 = new Gtk.Button("Button 2"); hbox.PackStart(button1, true, true, 0); hbox.PackStart(button2, true, true, 0);
Gtk.VBox vbox = new Gtk.VBox(false, 0); Gtk.Label label1 = new Gtk.Label("Label 1"); Gtk.Entry entry1 = new Gtk.Entry(); Gtk.Label label2 = new Gtk.Label("Label 2"); Gtk.Entry entry2 = new Gtk.Entry(); vbox.PackStart(label1, false, false, 0); vbox.PackStart(entry1, false, false, 0); vbox.PackStart(label2, false, false, 0); vbox.PackStart(entry2, false, false, 0);This code creates a vertical box container and four widgets. The `PackStart` method is called on each widget to add them to the container with no allocation or padding. The result is two labels and two entry boxes stacked vertically in the container. In both examples, the Gtk# library is used to create and manipulate the widgets and containers.