如何在打印区域中设置Richtextbox [英] How to set Richtextbox in print area

查看:95
本文介绍了如何在打印区域中设置Richtextbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vb.net上有一个带有OleDb数据库的应用程序。

这是我在Richtextbox中打印文本的代码。

I have an application in vb.net with OleDb database.
Here is my code to print text in Richtextbox.

Dim font3 As Font = New Drawing.Font("arial", 10, FontStyle.Underline)
e.Graphics.DrawString(Me.RBC_Seriestxt.Text, font3, Brushes.Black, 170, 660)



但是当打印文本时,它会以单行打印所有文本,而不限于表单中的Richtextbox。

那么该怎么办?


But when print the text, it prints all text in single line and its not limited to size of Richtextbox in the form.
So what to do ?

推荐答案

尝试下面

try below
Dim formatter as StringFormat  = New StringFormat()
formatter.LineAlignment = StringAlignment.Center
formatter.Alignment = StringAlignment.Center

Dim rectangle As RectangleF = New RectangleF(0, 0, richTextBox.Width, richTextBox.Height)
Dim font3 As Font = New Drawing.Font("arial", 10, FontStyle.Underline)
e.Graphics.DrawString(Me.RBC_Seriestxt.Text, font3, Brushes.Black, rectangle, formatter)





并查看下面的文章

绘制WinForms控件 [ ^ ]


这篇关于如何在打印区域中设置Richtextbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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