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, false, false, 5); ListStore store = new ListStore ( typeof(Gdk.Pixbuf), typeof(string), typeof(string) ); TreeView treeView = new TreeView(store); treeView.AppendColumn(new TreeViewColumn("", new CellRendererPixbuf(), "pixbuf", 0)); treeView.AppendColumn(new TreeViewColumn("Id", new CellRendererText(), "text", 1)); treeView.AppendColumn(new TreeViewColumn("Name", new CellRendererText() { Xpad = 4 }, "text", 2) { MinWidth = 20, Resizable = true, SortColumnId = 2 }); //Пустишка для заповнення вільного простору treeView.AppendColumn(new TreeViewColumn()); var img = new Gdk.Pixbuf("form.ico", 16, 16); store.AppendValues(img, "1", "Name A"); store.AppendValues(img, "2", "Name B"); store.AppendValues(img, "3", "Name C"); hBox.PackStart(treeView, true, true, 5); ShowAll(); } }
© accounting.org.ua - 2024