• 打印 保存


    //打印
            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();
                }
            }
  • 相关阅读:
    oracle语法
    cin.clear()、cin.sync()
    Intellij Idea Spring Boot 热部署
    navicat_premium_x64最新版安装说明
    激活navicat premium12
    时间戳Unix和时间之间的转换
    排序算法-- 大总结
    The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
    final
    static
  • 原文地址:https://www.cnblogs.com/zxm1002/p/4939729.html
Copyright © 2020-2023  润新知