[Gtk-sharp-list] Placing controls and sizing them
Mariano Benedettini
mbenedettini at ad-net.us
Mon Dec 19 12:39:38 EST 2005
You should use Boxes. Here's go a working example, a modified version of
the one found in http://www.mono-project.com/GtkSharpBeginnersGuide :
using System;
using Gtk;
public class GtkHelloWorld {
public static void Main() {
Application.Init();
//Create the Window
Window myWin = new Window("My first GTK# Application! ");
myWin.Resize(200,200);
Button myButton = new Gtk.Button("Example button");
VBox myVBox = new VBox();
HBox myHBox = new HBox();
myHBox.PackStart(myButton, false, false, 5);
myVBox.PackStart(myHBox, false, false, 0);
myWin.Add(myVBox);
//Show Everything
myWin.ShowAll();
Application.Run();
}
}
John Meyer wrote:
> All right, but I can't use PackStart from the window.
>
> Here's my code
>
> public MyWindow () : base ("MyWindow")
> {
> this.SetDefaultSize (400, 300);
> Button btn = new Button("Click me");
> btn.Clicked += new EventHandler(btn_click);
> btn.SetSizeRequest(50,50);
> this.Add(btn);
>
> Mariano Benedettini wrote:
>
>> See the fill and expand properties:
>>
>> http://www.go-mono.com/docs/monodoc.ashx?tlink=5@ecma%3a707%23Box%2fM%2fPackStart%2f3
>>
>>
>> If you are using Glade, just uncheck the options at design time.
>>
>> Mariano.
>
>
>
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
>
More information about the Gtk-sharp-list
mailing list