14.06.2024 13:37 Gtk3
Приклад використання віджету Calendar. Календар.

dotnet new consoledotnet add package GtkSharpdotnet runusing 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, true, true, 5);
Calendar calendar = new Calendar() { Date = DateTime.Now };
calendar.DaySelectedDoubleClick += (object? sender, EventArgs args) =>
{
Console.WriteLine(calendar.Date);
};
hBox.PackStart(calendar, true, true, 5);
ShowAll();
}
}© accounting.org.ua - 2025