Я должен добавить изображение в ImageList к кнопке из файла ресурсов с путем.Я попробовал следующий код:
private void AddMyImage()
{
//assign image to imagelist
imgList.Images.Add(Image.FromFile(@"Resources\SoccerBall.jpg"));
//Assign the ImageList to the button control.
button1.ImageList = imgList;
// Select the image from the ImageList (using the ImageIndex property).
button1.ImageIndex = 0;
imgList.ImageSize = new Size(120, 120);
}
private void Form1_Load(object sender, EventArgs e)
{
AddMyImage();
}
Я получаю ошибку ExceptionUnhandled во время выполнения, говоря System.IO.FileNotFoundException: '... \ Resources \ SoccerBall.jpg'
Что будетпуть к ресурсу?