[Gtk-sharp-list] (newbie) Changing an image

John Luke jluke@users.sourceforge.net
Tue, 24 Feb 2004 21:01:07 -0500

On Tue, 2004-02-24 at 20:51, Shaun ONeil wrote:
> first off, a warning. I'm entirely unfamiliar with C#, gtk/gdk/etc ..
> I'm at home with PHP, but I'm desperately trying to get a simple app to
> work.
> I have an Image, within an EventBox, within a TrayIcon, as such:
> EventBox eb = new EventBox ();
> eb.Add (new Image (new Gdk.Pixbuf (null, "images/inactive.png")));
> TrayIcon t = new TrayIcon ("watch");
> t.Add (eb);
> t.ShowAll ();
> What I can't for the life of me figure out, is how to change the Image
> (to images/active.png, fwiw) later on.
> Can anyone spare a moment to spare a hint, and/or point me towards some
> docs that offer a little more than 'To be added' ?
> TIA,
>   Shaun

Do something like:
Image image = new Image (new Gdk.Pixbuf (null, "images/inactive.png"));
eb.Add (image));

then when you want to change it:
image.Pixbuf = new Gdk.Pixbuf (null, "images/inactive.png");

You will want to read through any of the C# tutorials you might find
through google, or a C# book if you would prefer that.