Image myImage = new Bitmap(600, 600);
......
 myImage.Save("c:\\1.bmp");现在图片保存地址是死的,怎么改成弹窗保存对话框形式。新手最好给出代码。

解决方案 »

  1.   

    不能做成image button吗?做成image button然后在事件里写代码
      

  2.   

    SaveFileDialog   saveFileDialog1   =   new   SaveFileDialog(); 
                            saveFileDialog1.Filter   =   "Txt文件(*.txt)|*.txt|PDF文件(*.pdf)|*.pdf|所有文件(*.*)|*.* "; 
                            saveFileDialog1.Title   =   "保存文件 "; 
                          
                            //StreamWriter   myStream   =   new   StreamWriter(saveFileDialog1.FileName); 
                            if   ((saveFileDialog1.ShowDialog())   ==   DialogResult.OK) 
                            { 
                                    if   (saveFileDialog1.FileName   !=   null) 
                                    { 
                                            //myStream.Write(this.richTextBox1.Text); 
                                            //myStream.Close(); 
                                            this.richTextBox1.SaveFile(saveFileDialog1.FileName,   RichTextBoxStreamType.PlainText); 
                                    }                         } 
      

  3.   

    楼主,我教你个投机取巧的方法。
    你先把图片保存到一个制定路径。
    string filename;
    //定义一个指定路径 
    Response.AppendHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode((路径), System.Text.Encoding.UTF8));
    //输出文件
                  Response.TransmitFile(filename);
                Response.End();
         File.Delete(filename);//删除指定路径文件 、、这样的话,就会弹出另存为窗口了,不用你手输路径。手输路径的话,容易打错的。
      

  4.   

    Image myImage = new Bitmap(600, 600);
    ......
     myImage.Save("c:\\1.bmp"); 在Class1.cs类里面的
      

  5.   

    补充;上面的路径=="c:\\1.bmp");
      

  6.   

    fileinfo file=new fileinfo(路径 );
    file.delete();
      

  7.   

    另:File.Delete(路径)
    可以删除的。你调试下,看路径是不是错误了。
      

  8.   

      string filename = "c:\\1.bmp";
                //定义一个指定路径  
                Response.AppendHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(("123.bmp"), System.Text.Encoding.UTF8));
                //输出文件
                Response.TransmitFile(filename);
                Response.End();            FileInfo file = new FileInfo(filename);
                file.Delete();
               不行呢?
      

  9.   

    对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起对不起

    。你把Response.End();
    去掉试下。等你消息。
      

  10.   

     Response.End();
    调试到这里 结束了 没有继续往下走了
      

  11.   

    说一下逻辑啊。
    首先,你以前的方法已经实现了,把一个文件保存在了某个路径下。如路径名字是filename;
          string filename = xx ;       //你保存的 路径   
            Response.AppendHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode((filename), System.Text.Encoding.UTF8));
            //输出文件
            Response.TransmitFile(filename);
            FileInfo file = new FileInfo(filename);
            file.Delete();
      

  12.   

    我的文件保存在
    c:\\1.bmp
      

  13.   


     string filename = xx ; //你保存的 路径   
     Response.AppendHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode((filename), System.Text.Encoding.UTF8));//输出文件的名字,可以自己定
      Response.TransmitFile(filename);  //输出文件
      FileInfo file = new FileInfo(filename);
      file.Delete();我试了,可以的。你自己检查下吧。呵呵,有事叫我,一起进步。
      

  14.   

    你可以先在c盘根目录下建个1.bmpstring filename = "C:\\1.bmp"; //你保存的 路径   
     Response.AppendHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode((filename), System.Text.Encoding.UTF8));//输出文件的名字,可以自己定
      Response.TransmitFile(filename);  //输出文件
      FileInfo file = new FileInfo(filename);
      file.Delete();
      

  15.   

    上班,上不了QQ,邮箱[email protected] 
      

  16.   

    按照你们的方法是行不通的,做web要有服务端和客户端的概念,你现在在开发,你的客户端和服务端是一台电脑,当其他人访问你的电脑,也就是你的电脑做服务端,其他人的电脑做客户端,就行不通了,所以说在网页上选择路径保存图片是行不通的~~~
      

  17.   

    兄弟,,没收到。。算了,不用企业邮箱了。[email protected]
      

  18.   

    保存路径直接设置为Server.MapPath("/,,")就可以了,为什么能行不通呢。呵呵
      

  19.   

    下载文件
    string fileName = "";//客户端保存的文件名
                string filePath = Server.MapPath("");//路径            FileInfo fileInfo = new FileInfo(filePath);
                Response.Clear();
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
                Response.AddHeader("Content-Length", fileInfo.Length.ToString());
                Response.AddHeader("Content-Transfer-Encoding", "binary");
                Response.ContentType = "application/octet-stream";
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
                Response.WriteFile(fileInfo.FullName);
                Response.Flush();
                Response.End();
      

  20.   

    这问题就不回答了,拖个控件就是了,自己去查MSDN