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 { Toolbar ToolbarTop = new Toolbar(); public FirstWindow() : base("Test") { SetDefaultSize(600, 600); SetPosition(WindowPosition.Center); DeleteEvent += delegate { Program.Quit(); }; VBox vBox = new VBox(); Add(vBox); vBox.PackStart(ToolbarTop, false, false, 0); CreateToolbar(); ShowAll(); } void CreateToolbar() { ToolButton addButton = new ToolButton(new Image(Stock.Add, IconSize.Menu), "Додати") { TooltipText = "Додати" }; addButton.Clicked += OnAddClick; ToolbarTop.Add(addButton); ToolButton upButton = new ToolButton(new Image(Stock.Edit, IconSize.Menu), "Редагувати") { TooltipText = "Редагувати" }; upButton.Clicked += OnEditClick; ToolbarTop.Add(upButton); ToolButton copyButton = new ToolButton(new Image(Stock.Copy, IconSize.Menu), "Копіювати") { TooltipText = "Копіювати" }; copyButton.Clicked += OnCopyClick; ToolbarTop.Add(copyButton); ToolButton deleteButton = new ToolButton(new Image(Stock.Delete, IconSize.Menu), "Видалити") { TooltipText = "Видалити" }; deleteButton.Clicked += OnDeleteClick; ToolbarTop.Add(deleteButton); ToolButton refreshButton = new ToolButton(new Image(Stock.Refresh, IconSize.Menu), "Обновити") { TooltipText = "Обновити" }; refreshButton.Clicked += OnRefreshClick; ToolbarTop.Add(refreshButton); } void OnAddClick(object? sender, EventArgs args) { } void OnEditClick(object? sender, EventArgs args) { } void OnCopyClick(object? sender, EventArgs args) { } void OnDeleteClick(object? sender, EventArgs args) { } void OnRefreshClick(object? sender, EventArgs args) { } }
© accounting.org.ua - 2024