C#储存picturebox上的图形

来源:百度知道 编辑:UC知道 时间:2024/06/30 20:41:11
private void MenuSave_Click(object sender, EventArgs e)
{
// Displays a SaveFileDialog so the user can save the Image
// assigned to Button2.
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif";
saveFileDialog1.Title = "Save an Image File";
saveFileDialog1.ShowDialog();

// If the file name is not an empty string open it for saving.
if (saveFileDialog1.FileName != "")
{
// Saves the Image via a FileStream created by the OpenFile method.
System.IO.FileStream fs =
(System.IO.FileStream)saveFileDialog1.OpenFile();
// Saves the Image in the appropriate ImageFormat based upon the
// File type selected in th

取巧更快,把图片的路径保存在数据库,然后把图片命名为1 2 3 这样的名字。然后把路径保存起来。 要用的时候调用路径,这样不就OK 了马?

private void MenuSave_Click(object sender, EventArgs e)
{

SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif";
saveFileDialog1.Title = "Save an Image File";
saveFileDialog1.ShowDialog();
string fs;
if (saveFileDialog1.FileName != "")
{

fs=saveFileDialog1.FileName;
switch (saveFileDialog1.FilterIndex)
{
case 1:
this.pictureBox1 .Image.Save(fs,
System.Drawing.Imaging.ImageFormat.Jpeg);
break;

case 2:
this.pictureBox1.Im