C#存图片
一个WinForm,有一个按钮,点击下,弹出一个文件对话框和另一个Winform,
private void Col_Click(object sender, EventArgs e)//添加模板按钮
{
string str = InputBox.ShowInputBox("输入模板名", string.Empty);//
if (str.Trim() != string.Empty)
{
int i = 0;
persondata.Add(new person(str));
int j = persondata.Count - 1;
Form2 frm = new Form2();
frm.Show();
frm.Text = str;
OpenFileDialog ofd = new OpenFileDialog();
//ofd.Multiselect = true;
if (ofd.ShowDialog() == DialogResult.OK)
{
bmp = (Bitmap)Image.FromStream(GetImgStream(ofd.FileName));
image = new Emgu.CV.Image<Bgr, Byte>(bmp);
sbmp = new Bitmap(128, 128, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
norm = new Emgu.CV.Image<Gray, Byte>(sbmp);
int x = HJFace.FaceLocated(image.Ptr, norm.Ptr, persondata[j].Pfeature[0], 0);
isface.Text = x.ToString();
if (x == 0)
{
sbmp = IplImagePointerToBitmap(norm.Ptr);
}
else
{
pictureBox1.Image = null;
}
}
}
}
如何把图片存到Form2中,有好想法的请提供,高手赐教