Squirrel
Squirrel

Reputation: 137

Gtk# background image

I just started to use Gtk# today, and I'm astonished how few Documentation and exampleprojects are out there. Anyways I wanted to ask, does anybody know how to add a backgroundimage to a window or a widget? Or I don't know is it possible to stack multiple widgets over each other beacause, because then it would be quite easy.

Upvotes: 1

Views: 1880

Answers (1)

ApprenticeHacker
ApprenticeHacker

Reputation: 22011

Gtk.Window is for the GUI, for background images you need to use Graphics i.e you need to access the underlying GdkWindow . In Gtk# simply use

 Gtk.Window mwin = new Gtk.Window();
 Gdk.Window gwin = mwin.GdkWindow;

then use Gdk.Pixbuf to set the background image. Here's a link that may be helpful, it is in PHP-GTK, but it shouldn't be too hard to convert to C#.

http://www.kksou.com/php-gtk2/articles/place-a-background-image-in-GtkWindow.php

Upvotes: 1

Related Questions