Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System;
using Gtk;
class MainClass
{
public static void Main (string[] args)
{
Application.Init ();
var win = new Window ("Main Window");
var box = new VBox ();
box.BorderWidth = 20;
var b = new Button ("Click me");
var img = new Image ();
box.PackStart (b, false, false, 0);
box.PackStart (img, false, false, 0);
win.Add (box);
b.Clicked += delegate {
Gdk.Window w = b.GdkWindow;
img.Pixbuf = Gdk.Pixbuf.FromDrawable (w, w.Colormap, b.Allocation.X, b.Allocation.Y, 0, 0, b.Allocation.Width, b.Allocation.Height);
};
win.ShowAll ();
Application.Run ();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment