pictureBox 里的图片怎么用windows的图片查看器打开
pictureBox 里的图片怎么用windows的图片查看器打开 我的pictureBox里面的图片是数据库获取的2进制数转成image的
{
OdbcConnection cn;
OdbcCommand cmd;
OdbcDataReader rs=null;
string MyString;
MyString="Select * from gen_studentinfo";
cn= new OdbcConnection("DSN=mysql1;");
cn.Open();
cmd=new OdbcCommand(MyString,cn);
try
{
rs=cmd.ExecuteReader();
if(rs.Read())
{
byte[]tmp;
Bitmap MyImage;
tmp=(byte[])rs["si_photo"];
if(File.Exists("tmp.tmp")) //文件是否存在
{
File.Delete("tmp.tmp");
}
FileStream fs = new FileStream("tmp.tmp",FileMode.CreateNew);
BinaryWriter w = new BinaryWriter(fs);
w.Write(tmp);
w.Close();
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage ;
MyImage = new Bitmap("tmp.tmp");
pictureBox1.ClientSize = new Size(pictureBox1.Width,pictureBox1.Height);
pictureBox1.Image=(Image)MyImage ;
System.Windows.Forms.MessageBox.Show(rs["si_name"].ToString());
}
}
catch
{ }
finally
{
cn.Close();
cn.Dispose();
}
System.Windows.Forms.MessageBox.Show("Connected");
} this.pictureBox1.Image.Save(@"d:\1.jpg"); 谢谢 不过你不是我想要的东西 还是谢谢你们
页:
[1]
