如何给Delphi窗体添加背景图片
如何向我的 delphi 表单添加背景图像? 我添加了一个 TImage,但现在标签不再可见,并且复选框的文本位于蓝色“框”中(蓝色是我选择的背景颜色)。 这种蓝色在背景图像上看起来不太好,隐藏的标签也看起来不太好。 我该如何解决这些问题?
How can I add a background image to my delphi form? I added a TImage, but now the labels aren't visible any more, and the texts of my checkboxes are in a blue "box" (blue is the background color i chose). This blue doesn't look very good on the background image, and the hidden labels also don't look good. How do I fix these problems?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于标签:确保它们是透明的(对象检查器中的透明属性),并且它们在控件的 Z 顺序中位于 TImage 的顶部。 要纠正此问题,您可以在设计模式下对 TImage 组件执行“发送到底层”命令,这将使所有其他非窗口控件显示在其顶部。
对于复选框,我不知道您的情况有什么问题,在 Delphi 2007 中,当放在 TImage 上时,复选框显示正确透明。 也许您使用早期的 Delphi 版本? 如果是这样,最好在问题中提及这一点。 根据主题是否处于活动状态,还可能有不同的行为。 同样,如果没有进一步的信息,很难说。
For the labels: make sure that they are transparent (Transparent property in the Object Inspector), and that they are on top of the TImage in the Z-order of controls. To correct this you can execute the "Send to back" command on the TImage component in design mode, it will make all other non-windowed controls appear on top of it.
For the checkboxes I don't know what the problem in your case is, in Delphi 2007 checkboxes appear properly transparent when put over a TImage. Maybe you use an earlier Delphi version? If so it would be good to mention this in the question. There may also be a different behaviour depending on whether themes are active. Again, hard to say without further information.
将 TImage 移动到表单的后面(右键单击,排序 -> 发送到后面)。
Move the TImage to the back of the form (right click, order -> send to back).
对于标签,将透明属性设置为 true。 对于复选框和单选按钮,至少在我可以访问的 Delphi 6 中,没有透明属性。 解决这个问题的方法是将控件标签减小到零大小并提供您自己的附加 TLabel(可以是透明的)。
我还可以说,我发现带有背景图像的窗口非常糟糕,而且我知道我并不孤单。
For labels, set the Transparent property to true. For checkboxes and radio buttons, at least in Delphi 6 which is all I have access to, there is no transparent property. The way round this is to reduce the controls label to zero size and the provide your own additional TLabel, which can be transparent.
Can I also say that I find windows with background images ultra naff, and I know I'm not alone in this.