How to get image from a folder path in wpf

后端 未结 3 447
天命终不由人
天命终不由人 2021-01-21 00:17

I\'m trying to understand how to make a get a file from my project I\'m using visual studio 2010, and I have a folder in my wpf project that is called: Images

How can I

3条回答
  •  Happy的楠姐
    2021-01-21 01:00

    you can look at something like this

    string imageName = name + ".jpg";
    var path = Path.Combine(GetApplicationFolder(), "/Images/" + imageName);
    

    if you want to find it via the Assembly you could use the following as well

    var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
    

提交回复
热议问题