C#调用保存在dll中的图片

  保存图片的dll代码

public class mydll
{
public mydll()
{
    this.GetType().Assembly.GetManifestResourceStream( "yourDllName.yourImage.JPG" );
}

public System.IO.Stream ReturnStream()
{
return this.GetType().Assembly.GetManifestResourceStream( "yourDllName.yourImage.JPG" );
}
}

注意:要将图片yourImage.JPG 修改"生成方式"(Build Action)为"嵌入资源"(Embeded Resource)

然后在要调用的程序中:

private void Form1_Load(object sender, System.EventArgs e)
{
    yourDllName.mydll   yy= new mydll();
    pictureBox1.Image = Image.FromStream( yy.ReturnStream() );
}

 

来源:http://www.cnblogs.com/tuyile006/archive/2006/11/23/569816.html

加支付宝好友偷能量挖...


评论(0)网络
阅读(72)喜欢(0)Asp.Net/C#/WCF