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); HBox hBox = new HBox(); vBox.PackStart(hBox, true, true, 5); StackSidebar stackSidebar = new() { Stack = new Stack() }; hBox.PackStart(stackSidebar, false, false, 5); hBox.PackStart(stackSidebar.Stack, true, true, 5); stackSidebar.Stack.AddTitled(new Label("page 1"), "page1", "page 1"); stackSidebar.Stack.AddTitled(new Label("page 2"), "page2", "page 2"); stackSidebar.Stack.AddTitled(new Label("page 3"), "page3", "page 3"); stackSidebar.Stack.AddTitled(new Label("page 4"), "page4", "page 4"); ShowAll(); } }
© accounting.org.ua - 2024