[Gtk-sharp-list] Displaying an image

Rafael Teixeira Rafael Teixeira <monoman@gmail.com>
Tue, 15 Feb 2005 09:33:08 -0200


Be sure to be in the main thread (the only one safe to alter
controls/widgets properties).

The excerpts from my code are:

<c-sharp>
=09=09public void RefreshFromLife()
=09=09{
=09=09=09MainWindow.Title =3D "LifeLets: "+ myLife.Name;
=09=09=09if (myLife.PathToPhoto !=3D null) {
=09=09=09=09try {
=09=09=09=09=09smallPhoto.FromPixbuf  =3D new Gdk.Pixbuf(myLife.PathToPhoto=
);
=09=09=09=09} catch (Exception e) {
=09=09=09=09=09Console.WriteLine("smallPhoto couldn't be Pixbuffed!!!/n{0}"=
, e);
=09=09=09=09}
=09=09=09} else {
=09=09=09=09Console.WriteLine("No PathToPhoto");
=09=09=09}=09=09=09
=09=09}

=09public void on_change_picture_activate (object sender, EventArgs a)
=09{
=09=09using (FileChooserDialog chooser =3D=20
=09=09=09new FileChooserDialog ("Choose new picture file", this.MainWindow,
FileChooserAction.Open,
=09=09=09=09Stock.Cancel, ResponseType.Cancel, Stock.Open, ResponseType.Ok)=
) {
=09=09=09chooser.SelectMultiple =3D false;
=09=09=09ResponseType response =3D (ResponseType) chooser.Run();
=09=09=09if (response =3D=3D ResponseType.Ok) {
=09=09=09=09myLife.PathToPhoto =3D chooser.Filename;
=09=09=09=09RefreshFromLife();
=09=09=09}
=09=09=09chooser.Destroy();
=09=09}
=09}
</c-sharp>


On Tue, 15 Feb 2005 11:09:08 +0100, Vincent Arnoux
<vincent.arnoux@rfo.atmel.com> wrote:
> Vincent Arnoux a =E9crit :
>=20
> > Mario Carri=F3n a =E9crit :
> >
> > I am using Gtk# from Mono 1.0.5 RPM. I cannot do this your way
> > because, as you can see in the code, this picture comes from a
> > screenshot.
> > Rafael, can you please provide me with the code you use that's
> > working, I really can't see what's wrong.
> >
> > Vincent
> > _______________________________________________
> > Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>=20
> I also need to say that when I restart the application, the image is
> reflecting the last scrrenshot I took, but when I push the button, the
> image is not refreshed (I need to restart)
>=20
> Vincent
>=20
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>=20

HIH,

--=20
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes.=20
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.