Hi,

> Is possible i get a System.Drawing.Image and transform to Gtk.Image?
>
> if yes, anyone have a sample? or can tell me how?

Gtk.Image can load Gdk.Pixbufs. Pixbufs can load from common image
encodings. So use the following function to get your pixbuf by saving
the System.Drawing.Image into memory then loading into the pixbuf
(originally posted by Eric Butler in May:
http://lists.ximian.com/pipermail/gtk-sharp-list/2005-May/005880.html)

private Gdk.Pixbuf ImageToPixbuf (System.Drawing.Image image)
{
        using (System.IO.MemoryStream stream = new System.IO.MemoryStream ()) {
                image.Save (stream, System.Drawing.Imaging.ImageFormat.Bmp);
                stream.Position = 0;
                return new Gdk.Pixbuf (stream);
        }
}


Michael
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to