zoukankan      html  css  js  c++  java
  • WinForm中“嵌入的资源”和“资源文件”数据的获取方式

    生成操作:嵌入的资源;复制到输出目录:不复制;

    //获取“嵌入的资源”数据

    Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(@"TestCustomForm.Res.button.btndown.bmp"));

    其中:TestCustomForm为项目名称,Res为项目下的文件夹,button为Res的子文件夹,btndown.bmp是文件名称。

    //获取项目中“资源文件”的数据

    Assembly asm = Assembly.GetExecutingAssembly();
    ResourceManager rm = new ResourceManager("TestCustomForm.Properties.Resources", asm);
    String str = rm.GetString("ApplicationName");    //添加到资源文件的字符串
    Image img = rm.GetObject("bamboo") as Image;  //添加到资源文件的图片

  • 相关阅读:
    SpringMVC扩展
    反射机制
    python day9
    python day8
    python day7
    python day6
    python day4
    python day3
    python day2
    python day1
  • 原文地址:https://www.cnblogs.com/junior/p/2381734.html
Copyright © 2011-2022 走看看