
正文
vb.net打印控件,vb编写打印功能
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
关于vb.net添加打印控件的用法
txt文件:
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来打印了,
相关问答
Q1: vb.net条码打印控件
工具箱,然后随便选择一项,右键 选择项,在.com控件里,microsoft bar ctrol 9.0
Q2: VB.NET 打印问题。
先拖过来控件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()







