开发者

c# picturebox point to filesystem

开发者 https://www.devze.com 2023-04-09 21:17 出处:网络
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,

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 D开发者_如何学运维ebug 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.


Try this

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


There are a number of ways to do this, you can use the ImageLocation property or the Load method to specify the path just take a look at the documentation here

0

精彩评论

暂无评论...
验证码 换一张
取 消