1. 程式人生 > >c#,讀取二維碼

c#,讀取二維碼

C# name AD HA bitmap decode character new string

/// <summary>
/// 讀取二維碼
/// 讀取失敗,返回空字符串
/// </summary>
/// <param name="filename">指定二維碼圖片位置</param>
static string Read1(string filename)
{
BarcodeReader reader = new BarcodeReader();
reader.Options.CharacterSet = "UTF-8";
Bitmap map = new Bitmap(filename);
Result result = reader.Decode(map);
return result == null ? "" : result.Text;
}

c#,讀取二維碼