techno
techno

Reputation: 6500

Positioning and Sizing Buttons in GTK#

Im trying to create a UI in GTK#(GTK .NET).I have created a window,pulled in a vbox,and on the top vbox i placed a button.But the button occupies the entire space.How can i reduce the button size and fix its position.

I have seen there is a fixed container,should i pull it in and avoid using vbox? The UI/window will be of fixed size anyway ie:user cannot change the size

Could some one explain

enter image description here

Upvotes: 0

Views: 5783

Answers (2)

I had this probleb too. Then I added container via Graphical Designer and put all necessary widgets throught code like this:

Label lab = new Label("Record");//widget you want to add
vbox1.PackStart(lab, false, false, 3);//method that add a widget into a Box containers
vbox1.ShowAll();

Alternativly you can create an object of ContainerChilc class and set all properties you need. Than just use add() method.

Upvotes: 0

Deffiss
Deffiss

Reputation: 1136

To build a nice sizeable UI you should use containers like vbox or hbox. If you want a monolitic window you may use Fixed container and manually set positions of controls like in WinFroms (although you may do it with vbox and hbox too). To control height and width you may set WidthRequest and HeightRequest properties. Also you may use Aligement control to set left/right and top/bottom paddings relatively to the current control's position. (sorry for russian labels on the screen):

enter image description here

Upvotes: 2

Related Questions