标签:blog class code ext int string 文件 line com har name
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 |
Stream ms; byte [] picbyte; OpenFileDialog open = new
OpenFileDialog(); open.Filter = "图片文件(*.jpg)|*.jpg|图片文件(*.png)|*.png|图片文件(*.bmp)|*.bmp|图片文件(*.jpeg)|*.jpeg" ; open.RestoreDirectory = true ; if
(open.ShowDialog() == DialogResult.OK) { if
((ms = open.OpenFile()) != null ) { picbyte = new
byte [ms.Length]; ms.Position = 0; ms.Read(picbyte, 0, Convert.ToInt32(ms.Length)); // 图片 model_BD010.BD010_008 = picbyte; ms.Close(); } } string
path = open.FileName; txtUserImg.Text = path; // 显示预览图片 picUser.Image = Image.FromFile(path); |
//流转化为图片
picPhoto.Image = Image.FromStream(new MemoryStream((byte[])str));
图片和流的相互转化 (c/s),码迷,mamicode.com
标签:blog class code ext int string 文件 line com har name
原文地址:http://www.cnblogs.com/wlzhang/p/3700807.html