如何將Base64字串資料轉回圖形

這也是一個MemoryStream的應用之一,不囉嗦,我們直接來瞧瞧程式碼吧~

Dim Str As String

Str = _
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8" & _
"YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA" & _
"CxMBAJqcGAAAA3VJREFUOE+lU/9P1HUYf+7gjvt87vP17jzsiOsqw7DpKbO7GczU2SGrucpSWc5go8Gw" & _
"kmE7aGUM5YfAyqhNiRBcWsrS4Dg1mBbZBAszqwV6kJeYfcOYcR73Acbx6s1Rf0HP9tp7772f5/W897xe" & _
"jw4A/a/gnT4SHMuJVI9uxeO1NXZnVobAm0hRVFJUBtt8Um12MvEcLcx5/umlvqqdKSkGUq1y4p1451oi" & _
"aTH5Cg42a9NA8PNQWLJnLhB4YyJBtVnJYFlE9qyXci9ejkM /gosWFFWaeL0pKoKUbIjN8W7sbnh91tA" & _
"nBHMxvvHBgY5NcMlSSKZJZksDxSt+aRnKnrjJhD6ZRptPdNwel4oF0RBR3Jm4dbWc8CVGwzXgYHhGQz9" & _
"Aezcd6k/2bbczi+p8u5r/+vv736eQaBXw0fdMQT7gIqmWzBZM7NJEHjb6k01n7Z0A8d7ptB+fgKBrzSc" & _
"/gEoeWNgsKJpZLTzUhxNXRpqjsawo2UaRe9EkPHgxlZRMFlIkSUyGpPlrCfqzviPALs/nsSeNg31HRr2" & _
"d8XxZnAKJe+NY+WrEaSXaBC3jCHJ9dRxM6cTEzNQFCVBwnEGiytv71lPVRzZVRNYtUuD5xUNrhdjMG2N" & _
"gvJjMGwegfG+zQHJrJNVC6tLEMxKNSuZyBFnJFHN+7BvXtkM+OcmIRRPQiyeSuCeijhUd0GraCAu0ZQV" & _
"zxGkppFitZPsuJ9s3tJcT/XNP927gWUM2bVzWLoL8LLTs+PrC0r6MpcscHM/Z2AEDhIFnuavb/Q9XI/x" & _
"RxuAZ1qAynag7gxQexrwtwH5zcD6A8BD1deuyne675XMzCezBPIdTkr1Fq7a0Bi9XXoMeDkINPYCXSGg" & _
"40eg8zJwimE/k9ofAEoZ2brXh0KyY9FdsmAiSluzPacsiGjdWeBthiPfAn3MEz3XZ+D2FRzKzd/e8f0I" & _
"u18DDn0DvPUFsIeRPdsQDqlpGU5S0hfn+A9fiZy6ymzcD1z8DegfBVZu2HY0SUcper2O37StujN8GzjP" & _
"jBZgOSfDQPG750ZFq2MJiczzsmPhI/Unh8aGNeCnMSBvS3mbXkfifxLrk5KUwsq9nw3HgPA48NrBL0dM" & _
"knW1xIaZkNBsSqZ5d7sf+6B7IPJkkf8E68pq2bb9O2mF7YTOYLSW1x3ubTxxIcKrqT7RPLex/wChysEH" & _
"uzPdJAAAAABJRU5ErkJggg=="

Dim B() As Byte
B = Convert.FromBase64String(Str)
Dim MS As IO.MemoryStream
MS = New IO.MemoryStream(B)
PictureBox1.Image = Image.FromStream(MS)

留言

這個網誌中的熱門文章

開啟cshtml檔案時,出現『並未將物件參考設定為物件執行個體』的錯誤訊息

無法設定中斷點 尚未載入符號檔

DataGridView欄位計算總合