[MonoDevelop] Resources not

Grzegorz Sobanski silk at boktor.net
Sun Jan 8 06:57:56 EST 2006


* Colm Gallagher <colm.gallagher at gmail.com> [2006-01-08 02:29]:
> I wanted to add the image to the assembly to avoid the local path, so I
> added a reference to logo.png and then tried the following:
> Gtk.Image logo = new Gtk.Image("logo.png");

You must use other constructor. This on is using local files.
The proper one is:
public Image (System.Reflection.Assembly assembly, string resource)

So, do:
Gtk.Image logo = new Gtk.Image(null, "logo.png");

Or
Gtk.Image logo = Gtk.Image.LoadFromResource("logo.png");

(And logo.png must be added to Resources part of the project)


-- 
Grzegorz "Silk" Sobański                        silk (at) boktor.net
Error messages from an old Apple C compiler:       http://boktor.net
String literal too long (I let you have 512 characters, 
that's 3 more than ANSI said I should)


More information about the Monodevelop-list mailing list