如何创建资源文件运行时 [英] how to create Resource file runtime

查看:92
本文介绍了如何创建资源文件运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
如何创建资源文件运行时以及如何保存图像并读取该图像?
感谢

hello
how to create Resource file runtime and how i can save imga ein this and read that image ?
thank

推荐答案



只需阅读有关在桌面应用程序中创建资源文件的MSDN文章 [
Hi,

Simply Reading MSDN Article on Creating Resource File in Desktop application[^] will gives you all the information.

You do not need to read anything more. And about storing Image, you can store image path in resource file.

Hope you got your answer from this link
Thanks
-Amit Gajjar


private void simpleButton1_Click(object sender, EventArgs e)
  {
      using (System.IO.MemoryStream oStream = new System.IO.MemoryStream())
      {
          this.layoutControl1.SaveLayoutToStream(oStream);
          using (ResXResourceWriter oWriter = new ResXResourceWriter(@"..\..\Properties\LayoutControl.resources.Resx"))
          {
              oWriter.AddResource("one", oStream.GetBuffer());
              oWriter.Generate();
              oWriter.Close();
          }
      }

  }

  private void simpleButton2_Click(object sender, EventArgs e)
  {
      ResourceManager rm = new ResourceManager("WindowsFormsApplication1.LayoutControl", Assembly.GetExecutingAssembly());
      var one = rm.GetObject("one");
      Console.WriteLine("");
  }


这篇关于如何创建资源文件运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆