//位图流直接加载到pictureBox
Bitmap qrCodeImage = qrcode.GetGraphic(5, Color.Black, Color.White, null, 15, 6, false);
MemoryStream ms = new MemoryStream();
qrCodeImage.Save(ms, ImageFormat.Jpeg);
Image img = Image.FromStream(ms);
pic.Image = img;
//保存pictureBox的图片
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.FileName = "qrcode_" + DateTime.Now.ToString("yyyyMMddHHmmss");
saveFileDialog.Filter = "JPEG (*.jpg)|*.jpg";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
string localFilePath = saveFileDialog.FileName.ToString();
pic.Image.Save(localFilePath);
}
原文地址:
https://www.opengps.cn/Blog/View.aspx?id=1000
文章的更新编辑依此链接为准。欢迎关注源站原创文章!