I also try button1.PasswordChar = ""; button1.PasswordChar = ''; button1.PasswordChar = null; button1.PasswordChar = string.Empty;
and all above not work, solve this issue as following
I also try button1.PasswordChar = ""; button1.PasswordChar = ''; button1.PasswordChar = null; button1.PasswordChar = string.Empty;
and all above not work, solve this issue as following
【更新記錄】
※更新日期:07:29 2019/02/16
※更新內容:
‧限制圖片大小在1MB內
‧顯示花費的時間
----------------------------------------------------------------------------------
※更新日期:05:18 2019/02/14
※更新內容:
Solve the image.save 在 GDI+ 中發生泛型錯誤
‧加入wait form
‧Base64轉圖片後pictureBox顯示錯誤
----------------------------------------------------------------------------------
※更新日期:08:39 2019/02/12
※更新內容:
‧加入Base64字串轉成圖片並顯示
----------------------------------------------------------------------------------
【原始碼特點】
‧本軟體是一個WinForm 圖片與Base64編碼轉換器。
■功能介紹
‧Image convert to Base64 string.
‧Base64 string covert to Image.
‧normal Base64 string and Web use Base64 string.
■Knows issues
‧Base64字串轉換圖片, 圖片不正確
‧大於300KB的圖片轉換很慢
‧Base-64 字元陣列或字串的無效長度。
1.支援 PNG、GIF、JPG、BMP、ICO 格式。
2.將圖片轉換為Base64編碼,可以讓你很方便地在沒有上傳檔的條件下將圖片插入其它的網頁、編輯器中。
這對於一些小的圖片是極為方便的,因為你不需要再去尋找一個儲存圖片的地方。
3.假定建立的代碼為"data:image/jpeg;base64, .....",那麼你只需要全部複製,然後在插入圖片的時候,
位址填寫這段代碼即可。
4.CSS中使用:background-image: url("data:image/png;base64,iVBORw0KGgo=...");
5.HTML中使用:<img src="data:image/png;base64,iVBORw0KGgo=..." />
6.圖片轉換Base64,無線開發、HTML5、CSS3必備的工具,CSS DataURI Base64 工具。
7.將圖片轉換成base64編碼的,在web網上一般用於小圖片上,不僅可以減少圖片的請求數量(集合到js、
css代碼中),還可以防止因為一些相對路徑等問題導致圖片404錯誤。
OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = @"All Image Files|*.bmp;*.ico;*.gif;*.jpeg;*.jpg;*.png;*.tif;*.tiff| Windows Bitmap(*.bmp)|*.bmp|Windows Icon(*.ico)|*.ico| Graphics Interchange Format (*.gif)|(*.gif)| JPEG File Interchange Format (*.jpg)|*.jpg;*.jpeg| Portable Network Graphics (*.png)|*.png| Tag Image File Format (*.tif)|*.tif;*.tiff"; if (ofd.ShowDialog() == DialogResult.OK) { ... }
public enum ImageFormat
{
bmp,
jpeg,
gif,
tiff,
png,
unknown
}
public static ImageFormat GetImageFormat(byte[] bytes)
{
// see http://www.mikekunz.com/image_file_header.html
var bmp = Encoding.ASCII.GetBytes("BM"); // BMP
var gif = Encoding.ASCII.GetBytes("GIF"); // GIF
var png = new byte[] { 137, 80, 78, 71 }; // PNG
var tiff = new byte[] { 73, 73, 42 }; // TIFF
var tiff2 = new byte[] { 77, 77, 42 }; // TIFF
var jpeg = new byte[] { 255, 216, 255, 224 }; // jpeg
var jpeg2 = new byte[] { 255, 216, 255, 225 }; // jpeg canon
if (bmp.SequenceEqual(bytes.Take(bmp.Length)))
return ImageFormat.bmp;
if (gif.SequenceEqual(bytes.Take(gif.Length)))
return ImageFormat.gif;
if (png.SequenceEqual(bytes.Take(png.Length)))
return ImageFormat.png;
if (tiff.SequenceEqual(bytes.Take(tiff.Length)))
return ImageFormat.tiff;
if (tiff2.SequenceEqual(bytes.Take(tiff2.Length)))
return ImageFormat.tiff;
if (jpeg.SequenceEqual(bytes.Take(jpeg.Length)))
return ImageFormat.jpeg;
if (jpeg2.SequenceEqual(bytes.Take(jpeg2.Length)))
return ImageFormat.jpeg;
return ImageFormat.unknown;
}