c#将Base64编码转为图片显示在XRpictureBox上
public Bitmap Base64toImage(string Strbase64)
{
byte[] byDep = Convert.FromBase64String(Strbase64);
MemoryStream msDep = new MemoryStream(byDep);
Bitmap bitDep = new Bitmap(msDep);
return bitDep;
}
//调用
ZyPersons QuaUser = XCode.Entity<ZyPersons>.Find("id", resultObject.QualitySupervisorId);
string Base64Qua = QuaUser.imgId.Replace("data:image/png;base64,", "").Trim(); //从数据库拿到保存的base64文件,将前面的前缀去除
this.pictureBox1.Image = Base64toImage(Base64Dep);
this.pictureBox1.Sizing = ImageSizeMode.AutoSize;//图片的自适应填充