Link to home
Start Free TrialLog in
Avatar of Nargzul
Nargzul

asked on

Load external ressources in c#

For a program I need to load and assign dynamically an image.

I've something like this:

FileStream file;
file = File.Open(@"./Ressources/led_on.png", FileMode.Open);
ledON = Image.FromStream(file);

But it's search in the bin/Debug repository. Is it possible to search the ressource folder in the source folder?(or have an automatic copy?)
ASKER CERTIFIED SOLUTION
Avatar of abel
abel
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nargzul
Nargzul

ASKER

It's on the Ressource tab?

Is it a way to include files corresponding to a pattern?

Like ressources/*.(png|jpg|gif) ?(or simply ressources/*
?

Sorry, I don't know what you mean. But what I mean is:

1. go to the Solution Explorer
2. Select the Resources/myfile.png file
3. Select the Properties window (right-click > Properties)
4. Change the "Copy to Output Directory" setting

that's all there is to it ;-)