我已經與器Resco API玩弄移動6個窗口:http://www.resco.net/和他們做的一件事是序列化的位圖圖像和Base64編碼,他們在.resx文件,例如像這樣:將位圖圖像序列化爲base64?
<data name="buttonCell2.ImagePressed" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAEMAAAAaCAMAAADblRF+AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAYZQTFRFtgAA////
wAAAygAA2wAA2AAA0gAAuQAAvQAAsQAAwwAAzgAAxgAA1QAA3wAA4gAAswAArgAA5QAA5wAArAAA6gAA
nQAA2QAAgAAA/wD/5AAApwAAxwAAugAA4AAAoQAAlQAAqgAAqAAAmgAAwgAAsAAAzQAA6AAA1wAA3gAA
dQAAfAAAogAAvgAAsgAA/fTprQAAzwAAqwAAfwAAzAAAxAAAkQAAxQAAtAAAtQAA9M6Rz4SEsSoq+PDw
agAAggAApAAAtDAw//36ZgAAewAAyX5+67uCbgAAdAAAyQkJjAAA+uO8qQYGoRsXtCwqeAAAYwAA1pld
fCQWZQcEkwAA2qlqtWU/dRgP/fXmnCcnqGU/+d24mwAApQAAqicnjgAA/Pn5/fTneCQVigAA4qtxhx0b
bAAA/fLkgCYY//38rB4edAcEp2E6owAAjx8UlwAA/ffucgAAcwAA0X94dgAAuXp2cAAAhQAAZQAAngAA
aAAAnwAAxzAwgiQejQAA6s/PrGpDfx8Ulyx+wgAAASBJREFUOE+l1dVWw1AUBNBzkhYIUigUuUnapO7u
WHF3d3d31z8nXYsvuGe/zzzOAGNs7fchnG7jkL5aMuIM2OJyWFck4CIpkwfljrlSj5AMtHIJJIWpdgY/
05G8SfY3c/HLpvw9g5Ntu1lu4iabP8bh/F21yI3cZMfoCowoGUc9gSPTByGnL2ghCPoQQopoIhER7jZV
M4mKcHuZrSPJIjxpngoSD8Lwa7SGJIpw5LaLJHaE7muoJQGEN71QTVJA6F+QBBIJ4SVnrSKxIsx8OStJ
nAjz+0qRa8P+Q8UJhL1nLdZAEOs9hYsBd8IrcfMmOo6BfY5FbFZuts4dY5NnD3OaK2XjknKdfe8aHWzo
cVXfaOGyNdh1U/4Gw3ocOcXL8T+dxW1D92ffagAAAABJRU5ErkJggg==
</value>
</data>
而且它被裝起來就像這樣:
this.buttonCell1.ImagePressed = ((System.Drawing.Image)(resources.GetObject("buttonCell1.ImagePressed")));
當我基地64解碼的價值,我收到了.bin文件,我可以在油漆加載,它看起來像按鈕圖像。
我的問題是:如何將位圖圖像(或真正的任何圖像)序列化爲文本,然後base64將其編碼,以便將其添加到Windows Mobile項目的resx文件中。
的OP實際上是在尋找如何從'BitmapImage'去Base64編碼'string',而不是Base64編碼的字符串'BitmapImage'。 – 2011-05-04 23:31:11