图像在运行时不显示 [英] Images are not displayed at runtime

查看:109
本文介绍了图像在运行时不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

我在各种按钮和标签控件上使用了几个图像.我是从项目属性窗口的添加资源"窗口导入它们的.

在设计时一切都很好.但是在运行时,这些控件上没有显示图像.我从属性窗口尝试过.然后还通过使用"My.Resources.ImageName"在运行时进行尝试.但一切都在脉搏.

我没有更改该应用程序目录.

我该如何解决这个问题?

谢谢您的期待.

问候
SKPaul

Dear Friends,

I have used couple of images on various button and label controls. I imported them by "Add Resources" window from project properties window.

Everything is quite well at design time. But at runtime, no image is shown on those controls. I tried it from properties window. Then also tried from runtime by using "My.Resources.ImageName". But all are in vein.

I did not change that application directory.

How can i solve this problem?

Thanking you in anticipation.

Regards
SKPaul

推荐答案

您是如何设置图像的?
每个控件都有一个 BackgroundImage属性 [ BackgroundImageLayout [按钮的类 [图片 [ ImageAlign [图像列表 [图像索引 [ ImageKey [
How did you set your image?
Each Control has a BackgroundImage Property[^] which should work by simply browsing for an image and setting it. Also make sure your BackgroundImageLayout[^] is set in a way that it can display your image.
However, a Class such as Button[^] also has Image[^], ImageAlign[^], ImageList[^], ImageIndex[^] and ImageKey[^].
Clearly, ImageIndex and ImageKey will not do much when ImageList is not set or is empty. An Image might not be displayed properly if ImageAlign is set to a specific value.
Also, keep in mind that if you set an image that has a transparent background that the image might simply not fit in the Control, causing you to see its transparent background instead of the actual image.
There might be other properties that prevent your Control from drawing its (Background)Image or you from seeing it.


这篇关于图像在运行时不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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