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); Button bOpenCalendar = new Button("Відкрити календар"); bOpenCalendar.Clicked += OnOpenCalendar; hBox.PackStart(bOpenCalendar, false, false, 5); ShowAll(); } void OnOpenCalendar(object? sender, EventArgs args) { Popover popoverCalendar = new Popover((Widget)sender!) { BorderWidth = 5 }; VBox vBox = new VBox(); Calendar calendar = new Calendar() { Date = DateTime.Now }; calendar.DaySelectedDoubleClick += (object? sender, EventArgs args) => { popoverCalendar.Hide(); }; vBox.PackStart(calendar, false, false, 0); popoverCalendar.Add(vBox); popoverCalendar.ShowAll(); } }
© accounting.org.ua - 2024