分配记事本文件时出现问题 [英] problem while assign notepad file

查看:63
本文介绍了分配记事本文件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我已经创建了窗口应用程序,我将从我的应用程序中打印
一个记事本文件,因此我将通过编码为该记事本文件分配字体. 问题是当我通过编码将条形码字体分配给该记事本文件时根本不接受
而且我得到的输出为空.

这是我的编码在这里

hi all , i have created window application, from my application i ll print
one notepad file , so i ll assign the font for that notepad file through coding
the problem is when i assign the barcode font to the that notepad file through coding its not at all accepting
and i am getting empty output.

this is my coding here

string printPath = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                      fileToPrint = new System.IO.StreamReader(bar_path);
                      printFont = new System.Drawing.Font("AV-Web-Mal1", 10.5F);
                      string barcode_printername = File.ReadAllText("C:\\Printer Name\\barcode printername.txt");
                      printDocument1.PrinterSettings.PrinterName = barcode_printername;
                      printDocument1.Print();
                      fileToPrint.Close();

推荐答案

您不想使用记事本为您打印.代码.这是有关该主题的CodeProject文章:

使用C#简化的.NET打印 [
You don''t want to use Notepad to print for you., You want to print from within your own code. Here''s a CodeProject article on the topic:

Simplified .NET Printing in C#[^]

If that doesn''t satisfy you, I got 229,000 reuslts back when I googled "c# print a text file codeproject".


您必须明确说明是否要从以下位置调用系统记事本您的应用程序或您设计的应用程序看起来像记事本

如果您在应用程序中调用Windows记事本之类的话.您不能从代码中更改字体.您将必须打开记事本并从(格式>>字体)菜单中手动更改字体

明确表示您真正想做什么?
You have to explain explicitly if you are calling the system notepad from your application or you design an application that looks like notepad

If you are calling the windows notepad in your application like. You cannot change the font from your code. you will have to open the notepad and change the font manually from the (Format >> Font) Menu

Explicitly means clearly what you really want to do?


这篇关于分配记事本文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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