//打印 private void label12_Click(object sender, EventArgs e) { printDialog1.Document = printDocument1; DialogResult isok = printDialog1.ShowDialog(); if (isok == DialogResult.OK) { printDocument1.Print(); } } private void pictureBox1_Click(object sender, EventArgs e) { printDialog1.Document = printDocument1; DialogResult isok = printDialog1.ShowDialog(); if (isok == DialogResult.OK) { printDocument1.Print(); } } //保存 private void pictureBox5_Click(object sender, EventArgs e) { SaveFileDialog savefiledialog1 = new SaveFileDialog(); savefiledialog1.Filter = "文本文件|*.txt|所有文件|*.*"; DialogResult isok = savefiledialog1.ShowDialog(); if (isok == DialogResult.OK) { string filename = savefiledialog1.FileName; //使用流写入 StreamWriter sw = new StreamWriter(filename); sw.Write(textBox1.Text); sw.Close(); } } private void label13_Click(object sender, EventArgs e) { SaveFileDialog savefiledialog1 = new SaveFileDialog(); savefiledialog1.Filter = "excel|*.xls|所有文件|*.*"; DialogResult isok = savefiledialog1.ShowDialog(); if (isok == DialogResult.OK) { string filename = savefiledialog1.FileName; //使用流写入 StreamWriter sw = new StreamWriter(filename); sw.Write(textBox1.Text); sw.Close(); } }