首页 > 资料收集 > C#直接调用项目中的资源

C#直接调用项目中的资源

image

Code
  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3.     ResourceManager rm = new ResourceManager("UseResourceBinary.Properties.Resources", Assembly.GetExecutingAssembly());
  4.     this.label1.Text = rm.GetString("姓名");
  5.     this.pictureBox1.Image = rm.GetObject("张筱祥照片") as Image;
  6. }
  7.  
  8. private void button2_Click(object sender, EventArgs e)
  9. {
  10.     this.label1.Text = Properties.Resources.姓名;
  11.     this.pictureBox1.Image = Properties.Resources.张筱祥照片;
  12. }

这个有点类似于易语言里面的常量和资源吧,直接把一些图片文件等存放到程序里面,需要用到的时候直接用属性调用,可以添加的资源有:

image

Popularity: 13% [?]

你可能对下面的内容也感兴趣

分类: 资料收集 标签: 阅读:859
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.

3718150474633154929112424204136344840324513627301092612313516391742725322194423144338215828