using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }        private void Form1_Load(object sender, EventArgs e)
        {
        }        private void button1_Click(object sender, EventArgs e)
        {
            using (SaveFileDialog saveFileDialog1 = new SaveFileDialog())
            {
                saveFileDialog1.Title = "另存为";
                saveFileDialog1.InitialDirectory = @"C:\";
                saveFileDialog1.Filter = "图片(*.gif)|*.gif|图片(*.jpg)|*.jpg";
                saveFileDialog1.AddExtension = true;
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    using (Image img = pictureBox1.Image)
                    {
                        img.Save(saveFileDialog1.FileName);
                    }
                }
            }
        }
    }
}

解决方案 »

  1.   


    C# codeusing System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.Drawing.Imaging;namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void Form1_Load(object sender, EventArgs e)
            {
            }        private void button1_Click(object sender, EventArgs e)
            {
                using (SaveFileDialog saveFileDialog1 = new SaveFileDialog())
                {
                    saveFileDialog1.Title = "另存为";
                    saveFileDialog1.InitialDirectory = @"C:\";
                    saveFileDialog1.Filter = "图片(*.gif)|*.gif|图片(*.jpg)|*.jpg";
                    saveFileDialog1.AddExtension = true;
                    if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                    {
                        using (Image img = pictureBox1.Image)
                        {
                            img.Save(saveFileDialog1.FileName);
                        }
                    }
                }
            }
        }
    }
      

  2.   

    提示
    Application.Run(new Form1())参数无效
      

  3.   

    ding  ding  ding  ding  ding 
      

  4.   

    呵呵,那是启动主窗体,应该是构造函数...这个问题解决请问如何设置文字水印相对Form窗体的位置,不要相对屏幕的位置,还有如何设置文字水印的字体呢?不要跟随图片分辨率的改变而改变
      

  5.   

    Application.Run(new Form1())参数无效错误参考:
    今天用c#做了个绘图小程序,突然在Application.Run(new Form1());处报错说:参数无效 未处理ArgumentException 找了半天,终于找出了错误。我有在paint事件里用到Graphics,代码如下:        private void pictureBox1_Paint(object sender, PaintEventArgs e)        {            Graphics graphics = e.Graphics;//添加引用,而不是创建新对象,所以不需要多此释放(disponse)            Bitmap bitmap_1 = Properties.Resources.p00_1;            Bitmap bitmap_2 = Properties.Resources.p01_1;            bool aaa = false;            for (int i = 1, j = 0; i < 55; j += 12, i++)            {                if (aaa)                {                    graphics.DrawImage(bitmap_1, 20 + j, 40, 60, 85);                    aaa = false;                }                else                {                    graphics.DrawImage(bitmap_2, 20 + j, 40, 60, 85);                    aaa = true;                }            }            //graphics.Dispose();//出错地方            bitmap_1.Dispose();            bitmap_2.Dispose();        }我把红色的地方注释掉就好了 ,相比大家都看出来了。我试图把一个引用(e.graphics)给释放掉。当然会报错了,希望对朋友们有帮助。