C#程序 访问Resources.resx中的资源 读取资源文件

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Resources;
using System.Reflection;
namespace WindowsApplication5
{
    public partial class Form1 : Form
    {
        ResourceManager  rmManager; 
        public Form1()
        {
            InitializeComponent();
            rmManager = Properties.Resources.ResourceManager;
            String[] sList = new String[4];
            for (int i = 1; i < 5; i++)
            {
                //访问字符串用GetString(),访问音频资源用GetStream()
               //访问图片对象用GetObject()
                sList[i - 1] = rmManager.GetString("String" + i); 
                MessageBox.Show(sList[i-1]);
            }
                
        }
    }
}


发表于:2013-09-29 14:58:17

原文链接(转载请保留): http://www.multisilicon.com/blog/a20276746.html

友情链接: MICROIC
首页