C#直接调用项目中的资源
Code
- private void button1_Click(object sender, EventArgs e)
- {
- ResourceManager rm = new ResourceManager("UseResourceBinary.Properties.Resources", Assembly.GetExecutingAssembly());
- this.label1.Text = rm.GetString("姓名");
- this.pictureBox1.Image = rm.GetObject("张筱祥照片") as Image;
- }
- private void button2_Click(object sender, EventArgs e)
- {
- this.label1.Text = Properties.Resources.姓名;
- this.pictureBox1.Image = Properties.Resources.张筱祥照片;
- }
这个有点类似于易语言里面的常量和资源吧,直接把一些图片文件等存放到程序里面,需要用到的时候直接用属性调用,可以添加的资源有:
Popularity: 13% [?]
最新评论