dotnet new console
dotnet add package GtkSharp
dotnet run
using Gtk; class Program { public static void Main() { Application.Init(); new FirstWindow(); Application.Run(); } public static void Quit() { Application.Quit(); } }
using Gtk; class FirstWindow : Window { public FirstWindow() : base("Test") { SetDefaultSize(600, 350); SetPosition(WindowPosition.Center); DeleteEvent += delegate { Program.Quit(); }; VBox vBox = new VBox(); Add(vBox); StackSwitcher stackSwitcher = new() { Stack = new Stack() }; //Stack { HBox hBox = new HBox(); hBox.PackStart(stackSwitcher, false, false, 5); vBox.PackStart(hBox, false, false, 5); } //Switcher { HBox hBox = new HBox(); hBox.PackStart(stackSwitcher.Stack, true, true, 5); vBox.PackStart(hBox, true, true, 5); } stackSwitcher.Stack.AddTitled(new Label("page 1"), "page1", "page 1"); stackSwitcher.Stack.AddTitled(new Label("page 2"), "page2", "page 2"); stackSwitcher.Stack.AddTitled(new Label("page 3"), "page3", "page 3"); stackSwitcher.Stack.AddTitled(new Label("page 4"), "page4", "page 4"); ShowAll(); } }
© accounting.org.ua - 2024