Gtk.VBox Class
A VBox is a specific type of Gtk.Container for packing widgets vertically.

See Also: VBox Members

Syntax

public class VBox : Box

Remarks

Other ways of laying out widgets include using a horizontal box, (see Gtk.HBox), a table, (see Gtk.Table), button boxes, etc.

Useful methods for manipulating boxes can be found in the superclass for HBox, Gtk.Box.

Here is a simple example of the class' usage:

C# Example

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);
	}	
}
  

Example

C# Example

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);
	}	
}
  

Example

Visual Basic .NET Example

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

  

Requirements

Namespace: Gtk
Assembly: gtk-sharp (in gtk-sharp.dll)
Assembly Versions: 2.12.0.0