WPF从相对位置反映图像 [英] WPF Dispay image from relative location

查看:139
本文介绍了WPF从相对位置反映图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的对话框中显示一个图像,该图像可以位于相对于.exe所在目录的目录中,例如

I would like to display an image on my dialog which could be located in a directory relative to the one the .exe is located in, e.g.

project
- data
 -- logo  //<-- that's where the image is located
-bin      //<-- that's where the .exe is in

默认图像应包含在.exe中,但在显示对话框时,\ data首先应检查\ logo目录,如果找到具有给定文件名的图像,则应使用该图像显示而不是.exe内的图像。

A default image should be included in the .exe but on displaying the dialog, the \data\logo directory should be checked first and if an image with the given filename could be found there that one should be used for display instead of the one that is inside the .exe.

有关如何执行此操作的任何想法?

Any ideas on how to do this?

谢谢,

tabina

推荐答案

使用 pack URI

pack://application:,,,/ReferencedAssembly;component/data/logo/image.png

这篇关于WPF从相对位置反映图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆