txt文件:
我们提供的服务有:做网站、成都网站建设、微信公众号开发、网站优化、网站认证、东乌珠穆沁ssl等。为近1000家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的东乌珠穆沁网站制作公司
procedure TForm1.Button1Click(Sender: TObject);
var
MyFile: TextFile;
SourceFile:TextFile;
Tmp:String;
begin
AssignPrn(MyFile);
AssignFile(SourceFile,'FilePath');
Reset(SourceFile);
Rewrite(MyFile);
Readln(SourceFile,Tmp);
While Not EOF(SourceFile) do
Begin
Writeln(MyFile, Tmp);
Readln(SourceFile,Tmp);
System.CloseFile(MyFile);
end;
图形文件需要TPrinter.canvas来打印了,
工具箱,然后随便选择一项,右键 选择项,在.com控件里,microsoft bar ctrol 9.0
先拖过来控件PrintDocument1,然后双击PrintDocument1,在它的PrintPage事件中加入代码如下:
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
dim a as String
a="abcd"
Dim mypen As Pen = New Pen(Color.Blue, 2)
e.Graphics.DrawString(a, New Font("宋体", 20), New Pen(Color.Black, 1).Brush, 30, 30)
End Sub
调用下面语句可直接用默认打印机打印出来:
PrintDocument1.Print()