日期:2014-05-18 浏览次数:20829 次
/// <summary> /// 存储事件:将图片转换为Byte数组并依据题号存储进相应字段中 /// </summary> private void button2_Click(object sender, EventArgs e) { this.imageByte = SetImageToByteArray(this.imageFileName); } /// <summary> ///图片转换为二进制数组 /// </summary> public byte[] SetImageToByteArray(string fileName) { FileStream fs = new FileStream(fileName, FileMode.Open); int streamLength = (int)fs.Length; byte[] image = new byte[streamLength]; fs.Read(image, 0, streamLength); fs.Close(); return image; }