TImage 丢失加载的图片
运行 Turbo Delphi Pro。
我正在使用 TImage 来显示 png 图像。
当我重新启动Delphi并加载dpr文件时,TImage仍然存在,但图片丢失了, 需要在编译之前重新加载图片。
一开始我以为是路径问题,所以就从和dpr同目录加载了图片,但是没有帮助。
我还能尝试什么?
Running Turbo Delphi Pro.
I'm using TImage to display a png image.
When I restart Delphi and load the dpr file, TImage is still there, but the picture is lost,
requiring a reload of the picture before compiling.
At first I thought it's a path issue, so I loaded the picture from the same directory as the dpr, but it didn't help.
What else can I try?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
巴布亚新几内亚。
DFM
你的TImage对象,因为PNG内容
尚未保存。
最重要的是,您必须将其作为资源包含并在运行时动态加载。
Try this:
the PNG.
DFM
your TImage object, because the PNG content
has not been saved.
Bottom line, you'd have to include it as a resource and load it dynamically at runtime.
我用D2006也遇到这个问题。我使用的解决方案与弗朗索瓦的类似。
我有一个 TPngImageCollection 组件,我在设计时收集所有图像。您需要从网上找到 PngImageList 单元。 TPngImageCollection 组件的优点是您可以拥有不同大小的 PNG 图像的集合。
在启动时的运行时,我分配来自每个集合成员的 TImage:
Bingo - 您可以生成具有 alpha 透明度的 PNG 原件(我使用 Serif 的 PhotoPlus 6.0 - 免费且非常强大)并在 TImage 中显示它们。
I ran into this problem as well with D2006. The solution I used is similar to François'.
I have a TPngImageCollection component that I collect all the images in at design time. You will need to find unit PngImageList off the web. The TPngImageCollection component has the advantage that you can have a collection of PNG images of differing sizes.
At run-time on startup, I assign the TImages from each of the collection members:
Bingo - you can produce your PNG originals with alpha transparency (I use PhotoPlus 6.0 from Serif - free and very capable) and show them in a TImage.