为什么透明背景的图像在 Silverlight 中不可见?
我创建了一个图像用作标尺。 它在透明背景上有黑色线条和文本,采用 PNG 格式。 将其添加到我的 XAML 后,我惊讶地发现图像不可见,更惊讶地发现当我加载 XAML 文件时它在 Blend 中可见。
什么可能导致图像在运行应用程序时不可见,即使它在设计时在 Blend 中可见?
I have created an image to use as a ruler. It has black lines and text on a transparent background and is in PNG format. After adding it to my XAML I was surprised to find that the image was not visible, and even more surprised to find it was visible in Blend when I loaded the XAML file there.
What might cause an image to be invisible when running the application, even though it is visible in Blend at design time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它可能与图像路径或参考有关。 您能否包含一些 XAML 或源代码来展示您如何设置图像源?
It might have to do with the image path or reference. Can you include some XAML or source code to show how you're setting the image source?
事实证明我很愚蠢,可悲的是,这种情况发生的次数超出了我的意愿。 我已将图像放置在磁盘上的 Images 文件夹中,但忽略了将其作为资源添加到项目中。 只需这样做即可按预期显示图像。
It turns out that I was being stupid, which sadly happens more than I'd like. I had placed the image in the Images folder on disk but had neglected to add it to the project as a resource. Simply doing so has the image appearing, as expected.