共用方式為


ResX 產生器 (RESXGEN)

ResX Generator (ResXGen) 是主控台公用程式,可以將影像檔案 (例如,.jpg 或 .bmp 檔案) 轉換為 XML 格式化 .resx 檔案,然後再使用 Resgen.exe 編譯為 .NET 相容的 .resources 檔案。

ResXGen (縮簡以便閱讀) 中的下列幾行程式碼,說明如何從影像檔案建立 .resx 檔案。

Image img = Image.FromFile(ap.InputFile);
ResXResourceWriter rsxw = new ResXResourceWriter(ap.OutputFile); 
rsxw.AddResource(ap.ResourceName, img);
rsxw.Close();

.NET Framework 中有介紹基本的 XML 結構描述 - 尤其在 ResXResourceWriter 類別的 ResourceSchema 屬性中。這個功能也被封裝在 ResXGen中,您只要執行下列命令,即可檢視結構描述:

ResXGen /schema