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); Entry entryText = new Entry() { PlaceholderText = "Текст підказки" }; //Поле для тексту { HBox hBox = new HBox(); vBox.PackStart(hBox, false, false, 10); hBox.PackStart(new Label("Поле для тексту:"), false, false, 5); hBox.PackStart(entryText, false, false, 10); } SearchEntry searchEntryText = new SearchEntry() { PlaceholderText = "Пошук" }; //Поле для пошуку { HBox hBox = new HBox(); vBox.PackStart(hBox, false, false, 10); hBox.PackStart(new Label("Поле для пошуку:"), false, false, 5); hBox.PackStart(searchEntryText, false, false, 10); } //Зберегти { HBox hBox = new HBox(); vBox.PackStart(hBox, false, false, 10); Button buttonSave = new Button("Зберегти"); buttonSave.Clicked += (object? o, EventArgs e) => { Console.WriteLine(entryText.Text); Console.WriteLine(searchEntryText.Text); }; hBox.PackStart(buttonSave, true, false, 0); } ShowAll(); } }
© accounting.org.ua - 2024