简体   繁体   中英

c# picturebox point to filesystem

i have a picture box in my win forms app. the question is, how can i make the image load from a directory within that application,

for example, i have a program and it lies under Debug directory. Now i have an image located under Debug/source/images/logo.png. I dont want to make use of resources file (embedded within the assembly)

How can i point it towards that path, instead of getting the image/picture from the local resources file.

有很多方法可以做到这一点,您可以使用ImageLocation属性或Load方法来指定路径,只需看一下这里的文档

尝试这个

String.Format(@"{0}\myDesiredPath\MyFile.MyExtension",System.Reflection.Assembly.GetExecutingAssembly().Location);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM