turbo pascal/c 实现Dos下控制(HP等)打印机打印汉字的编程思路和代码?谢谢
解决方案 »
- DBGrid选中行颜色问题??
- 为什么同样的时间插入语句,一个可以一个就变成了数字呢
- 数据库指针移动的问题?郁闷
- 请问高手:如何将form子窗口停靠在主窗口中?
- 请问一下如何实现连续播放.wav文件啊????
- RichEdit的简单问题,请高手近来看看帮帮忙!急急急...在线等待!!
- 流中的Write和WriteBuffer有什么区别?
- 高分求lm6pro控件(可用与delphi5的),分不够再加.
- 哪里下载d5adoupdate2.exe?
- 红旗linux2.0桌面版无法登入系统,求高手指点!
- 請教: .DB查詢問題
- 请用delphi作 当鼠标指向某个地方,出现在解释框,鼠标移开了就没有了,请问各们大虾怎么关现啊
Rewrite(MyFile);
strTemp := '中国人';
writeln(MyFile, FormatPRNString(strTemp));
System.CloseFile(MyFile);
Function FormatPRNString(str:string):string;
//将要打印的字符串转换成相应打印格式,适应于:EPSON TM300系统列
//刚写的,看看吧
var
ch:char;
i:integer;
chinese:boolean;
begin
chinese:=false;
i:=1;
while i<=length(str) do
begin
ch:=str[i];
if ch>#127 then
if str[i+1]>#127 then //一个完整折汉字
begin
if not chinese then result:=result+#28+#38;
chinese:=true;
result:=result+ch+str[i+1];
inc(i);
end
else //半个汉字
begin
if chinese then result:=result+#28+#46;
chinese:=false;
result:=result+#32;
end
else //ASCII码
begin
if chinese then result:=result+#28+#46;
chinese:=false;
result:=result+ch;
end;
inc(i);
end;
end;