[Gtk-sharp-list] (newbie) Changing an image
Tue, 24 Feb 2004 21:36:04 -0500
On Tue, 2004-02-24 at 21:01 -0500, John Luke wrote:
> 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.
Thank you very much, not only for the info, but the speed .. That's done
the trick perfectly.
I'm still coming to terms with everything being an object .. I was
trying to add/remove things from the EventBox rather than just changing
the image's properties.
Thank you again .. and I shall certainly be investing time in tutorials
- I hate being this clueless.