I have a Windows Forms
project. I have a Resources
folder and I wan to use the files there using relative path. Here is a printscreen of my project tree
As you may see I have folder UserControls
where I have FileExplorer.cs
it contains aa openFileDialog
+ pictureBox
. I use this control in some of my forms which are in Forms
folder. The case is that in Resources
folder I have this T380.jpg
image that I want to load by default but for now I can do it only by inserting the full path to it. Here is my code where I try to load the image:
private void FileExplorer_Load(object sender, EventArgs e)
{
pictureBox1.ImageLocation = @"ShoesUnlimitedAdmin\Resources\T380.jpg";
pictureBox1.Load();
}
I use the Load
event of the user control to load my image but it only works when I set the full path to the image like C:\\...
and so. How can I point to the Resources
folder of the project using relative path?