0

我正在使用 Winforms (C#.NET)。当我将资源(图像)添加到资源查看器时,我可以看到它们。

在此处输入图像描述

但是当我将它们添加到表单时,只有灰色背景可见 - 图像不可见。

在此处输入图像描述

但是当从本地资源加载图像时,它显示得很好。我认为问题出在项目资源文件上。我有事吗??


编辑:这是设计器代码...

 <data name="addemployee" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\addemployee1.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>


</data>
  <data name="addmovie" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>..\Resources\addmovie1.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>
  <data name="buytickets" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>..\Resources\buytickets1.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>
  <data name="changepassword" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>..\Resources\changepassword1.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>
  <data name="customerregistration" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>..\Resources\customerregistration1.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>
  <data name="deleteemployee" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>..\Resources\deleteemployee1.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>
  <data name="movietheater" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>..\Resources\movietheater1.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>
  <data name="welcomeadmin" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>..\Resources\welcomeadmin1.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>
  <data name="welcomeform3" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>..\Resources\welcomeform31.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>
  <data name="welcomeform4" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>..\Resources\welcomeform41.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>
4

2 回答 2

1

问题是 Visual Studio 的错误。尝试重新启动将对此有所帮助..

于 2012-07-03T16:32:42.460 回答
0

尝试将图像的属性更改为资源而不是内容并试一试

于 2012-07-03T16:06:34.163 回答