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); ScrolledWindow scroll = new ScrolledWindow(); scroll.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); hBox.PackStart(scroll, true, true, 5); FlowBox flowBox = new FlowBox { Orientation = Orientation.Horizontal, Valign = Align.Start, MinChildrenPerLine = 2, MaxChildrenPerLine = 5, SelectionMode = SelectionMode.None }; for (int i = 0; i < 23; i++) flowBox.Add(new Button($"{i}")); scroll.Add(flowBox); ShowAll(); } }
© accounting.org.ua - 2024