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(800, 600); SetPosition(WindowPosition.Center); DeleteEvent += delegate { Program.Quit(); }; VBox vBox = new VBox(); Add(vBox); //Блок 1 { HBox hBox = new HBox(); vBox.PackStart(hBox, false, false, 5); Expander expander = new Expander("Блок 1"); hBox.PackStart(expander, false, false, 5); VBox vBoxBlock = new VBox(); expander.Add(vBoxBlock); HBox hBoxBlock = new HBox(); vBoxBlock.PackStart(hBoxBlock, false, false, 5); Button button = new Button("Кнопка 1"); hBoxBlock.PackStart(button, false, false, 5); } //Блок 2 { HBox hBox = new HBox(); vBox.PackStart(hBox, false, false, 5); Expander expander = new Expander("Блок 2"); hBox.PackStart(expander, false, false, 5); VBox vBoxBlock = new VBox(); expander.Add(vBoxBlock); HBox hBoxBlock = new HBox(); vBoxBlock.PackStart(hBoxBlock, false, false, 5); Button button = new Button("Кнопка 2"); hBoxBlock.PackStart(button, false, false, 5); } ShowAll(); } }
© accounting.org.ua - 2024