[Gtk-sharp-list] Assign image window background

Michael Hutchinson m.j.hutchinson at gmail.com
Mon Jan 11 18:23:01 EST 2010

On Mon, Jan 11, 2010 at 8:32 AM, dkarantonis <dkarantonis at soft4real.com> wrote:
> dkarantonis wrote:
>> Hi to all,
>> i was wondering whether i could assign a background image to a gtk# widget
>> (actually a tab or a window), instead of just modifying its background
>> color (using ModifyBG()).
>> thanks in advance,
>> Dimitris
> Actually, my problem is that i would like to use a function like
> SetBackPixmap() that is available on gdk windows, but it is not available on
> gtk widgets.

Many widgets (e.g. containers, label) don't have a GdkWindow, and/or
do they render their own background. Hence modifying the bg colour on
the style won't actually have any effect on such widgets.

If the widgets don't have GdkWindows, you can put the widget in an
EventBox, which is simply a container that has no padding or border,
but has a GdkWindow so can catch events and draw its own background.

Michael Hutchinson

More information about the Gtk-sharp-list mailing list