打印多行文本框值 [英] Print a multiline textbox value

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

问题描述

如何在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();
           }
       }


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆