大神哪位知道,c#保存图片的问题,求高手;?
做的是父子窗口。父窗口代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace 画图板
{
public partial class fatherForm : Form
{
public fatherForm()
{
InitializeComponent();
}
public static PictureBox p1 = new PictureBox();
private void 另存为AToolStripMenuItem_Click(object sender, EventArgs e)
{
saveFileDialog1.Filter = "*.jpg|*.jpg|*.bmp|*.bmp|*.jpeg|*.jpeg|*.gif|*.gif|*.png|*.png|*.ico|*.ico";
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
p1.Image.Save(saveFileDialog1.FileName);
}
}
子窗口代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 画图板
{
public partial class ch : Form
{
PictureBox p1 = new PictureBox();
private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
fatherForm.p1.Image = pictureBox1.Image;
}
运行没问题,,但是保存的时候就会出现如下错误:
父窗口里面: