gtk-sharp2.12.0.0Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details.A VBox is a specific type of for packing widgets vertically.
using System;
using Gtk;
class VBoxTester {
static void Main ()
{
Application.Init ();
Window myWindow = new Window ("VBox Widget");
myWindow.SetDefaultSize (250, 100);
VBox myBox = new VBox (false, 4);
//Add the box to a Window container
myWindow.Add (myBox);
// Add some buttons to the container
VBoxTester.AddButton (myBox);
VBoxTester.AddButton (myBox);
VBoxTester.AddButton (myBox);
myWindow.ShowAll ();
Application.Run ();
}
static void AddButton (VBox box)
{
box.PackStart (new Button ("Button"), true, false, 0);
}
}
Imports System
Imports Gtk
Class VBoxTester
Shared Sub Main ()
Application.Init ()
Dim myWindow As New Window ("VBox Widget")
Dim myBox As New VBox (False, 0)
' Add the box to a Window container
myWindow.Add (myBox)
myWindow.SetDefaultSize (250, 100)
' Add some buttons to the box
VBoxTester.AddButton (myBox)
VBoxTester.AddButton (myBox)
VBoxTester.AddButton (myBox)
myWindow.ShowAll ()
Application.Run ()
End Sub
Shared Sub AddButton (ByVal box As VBox)
box.PackStart (New Button ("Button"), True, False, 0)
End Sub
End Class
Other ways of laying out widgets include using a horizontal box, (see ), a table, (see ), button boxes, etc.
Useful methods for manipulating boxes can be found in the superclass for HBox, .
Here is a simple example of the class' usage:
using System;
using Gtk;
class VBoxTester {
static void Main ()
{
Application.Init ();
Window myWindow = new Window ("VBox Widget");
VBox myBox = new VBox (false, 4);
//Add the box to a Window container
myWindow.Add (myBox);
myWindow.ShowAll ();
Application.Run ();
}
static void AddButton (VBox box)
{
box.PackStart (new Button ("Button"), true, false, 0);
}
}
Gtk.BoxConstructorInternal constructor
Pointer to the C object.
This is an internal constructor, and should not be used by user code.ConstructorThe main way to create a new VBox
If , all widgets in the box are forced to be equally sized.
The number of pixels to place between each widget in the box.
PropertyGLib.GTypeGType property.a Returns the native GObject type for .ConstructorProtected constructor.
a Chain to this constructor from subclasses when you manually register a for your subclass.System.ObsoleteConstructorVBox Constructor.Instantiates a object using default values for the spacing and homogeneous attributes.