包含vbnet打印控件使用的词条

关于vb.net添加打印控件的用法txt文件:
procedureTForm1.Button1Click(Sender:TObject);
var
MyFile:TextFile;
SourceFile:TextFile;
Tmp:String;
begin
AssignPrn(MyFile);
AssignFile(SourceFile,'FilePath');
Reset(SourceFile);
Rewrite(MyFile);
Readln(SourceFile,Tmp);
WhileNotEOF(SourceFile)do
Begin
Writeln(MyFile,Tmp);
Readln(SourceFile,Tmp);
System.CloseFile(MyFile);
end;
图形文件需要TPrinter.canvas来打印了,
vb.net如何实现打印DataGridView1里的内容,求源码使用 PrintDocument 控件的 Print() 方法可以打印指定对象中的内容,参考代码如下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PrintDocument1.Print()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim bm As New Bitmap(Me.DataGridView1.Width, Me.DataGridView1.Height)
DataGridView1.DrawToBitmap(bm, New Rectangle(0, 0, Me.DataGridView1.Width, Me.DataGridView1.Height))
e.Graphics.DrawImage(bm, 0, 0)
End Sub
VS2005如何用VB.NET代码实现打印功能有个PrintDocument控件,可以实现打印 。。。
MSDN原话:
使用 PrintDocument 组件
涉及 PrintDocument 组件的两种主要情况是:
简单的打印作业 , 如打印单个文本文件 。在这种情况下,应将 PrintDocument 组件添加到 Windows 窗体,然后在 PrintPage 事件处理程序中添加打印文件的编程逻辑 。该编程逻辑应以使用 Print 方法打印文档结束 。
此方法向打印机发送一个 Graphics 对象 , 该对象包含在 PrintPageEventArgs 类的 Graphics 属性中 。
有关如何使用 PrintDocument 组件打印文本文档的示例,请参见
如何:打印 Windows 窗体中的多页文本文件 。
更为复杂的打印作业 , 如想要重新使用已编写的打印逻辑的情况 。
在这种情况下,应从 PrintDocument 组件派生一个新组件,并重写
(请参见 Visual Basic 的 重写或 C# 的 重写) PrintPage 事件 。
将 PrintDocument 组件添加到窗体后 , 它出现在 Windows 窗体设计器底部的栏中
【包含vbnet打印控件使用的词条】vbnet打印控件使用的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于、vbnet打印控件使用的信息别忘了在本站进行查找喔 。

    推荐阅读