using Gtk; using System; class SharpApp : Window { Label label; public SharpApp() : base("Початкове вікно") { SetDefaultSize(300, 110); SetPosition(WindowPosition.Center); DeleteEvent += delegate { Application.Quit();}; label = new Label("Текст поточного кольору"); Button button = new Button("Вибрати колір"); button.Clicked += OnClicked; Fixed fix = new Fixed(); fix.Put(button, 80, 20); fix.Put(label, 30, 80); Add(fix); ShowAll(); } void OnClicked(object sender, EventArgs args) { ColorSelectionDialog cdia = new ColorSelectionDialog("Вибір кольору"); cdia.Response += delegate (object o, ResponseArgs resp) { if (resp.ResponseId == ResponseType.Ok) { label.ModifyFg(StateType.Normal, cdia.ColorSelection.CurrentColor);} }; cdia.Run(); cdia.Destroy(); } public static void Main() { Application.Init(); new SharpApp(); Application.Run(); } }