![](/img/trans.png)
[英]Problem in reading string resources kept in different assembly having resx files
[英]problem with resources reading
我有一个设计为按钮的用户控件。 问题是我无法将图像显示为背景。
public partial class inout_buton : UserControl
{
Bitmap bmp;
public inout_buton()
{
InitializeComponent();
try
{
Stream s = this.GetType().Assembly.GetManifestResourceStream("Network_Remote_Monitoring.but_verde.png");
bmp = new Bitmap(s);
s.Close();
}
catch
{
MessageBox.Show("it's bad");
}
this.BackgroundImage = bmp;
}
}
在此示例中,Network_Remote_Monitoring是我的命名空间,而but_verde.png是我想要的背景。 弹出的MessageBox总是显示=>不执行try语句。
你能找到问题吗?
public partial class inout_buton : UserControl
{
Bitmap bmp;
public inout_buton()
{
InitializeComponent();
try
{
bmp = new Bitmap(Network_Remote_Monitoring.Properties.Resources.but_verde);
}
catch
{
MessageBox.Show("it's bad");
}
this.BackgroundImage = bmp;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.