打印多行文本框值

打印多行文本框值

本文介绍了打印多行文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C#

推荐答案

private void btnprint_Click(object sender, EventArgs e)
       {
           if (AppLog.SelectedIndex == 0)
           {
               string path = (AppDomain.CurrentDomain.BaseDirectory).ToString() + "ErrorLog.txt";
               ReadFile(path);
               printDocument1.DocumentName = "Error Log Page";
               printDocument1.Print();
           }
           else
           {
               string path = (AppDomain.CurrentDomain.BaseDirectory).ToString() + "ApplicationLog.txt";
               ReadFile(path);
               printDocument1.DocumentName = "Application Log Page";
               printDocument1.Print();
           }
       }

















private void ReadFile(string path)//LogFileType pLogFileType
       {

           printDocument1.DocumentName = "";
           using (FileStream stream = new FileStream(path, FileMode.Open))
           using (StreamReader reader = new StreamReader(stream))
           {
               stringToPrint = reader.ReadToEnd();
           }
       }


这篇关于打印多行文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-31 07:06