如何设置A4尺寸的richtextbox [英] how to set richtextbox in A4 size

查看:143
本文介绍了如何设置A4尺寸的richtextbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我如何将richtextbox设置为A4大小

Please Tell Me How to set richtextbox into A4 size

推荐答案

也许这个讨论 [ ^ ]可以帮助你。
Maybe this discussion[^] can help you.


RichTextBox中没有这样的东西。



纸张尺寸和方向是严格的印刷概念,与RTB本身无关。唯一适用的时间是您的代码打印RTB的内容。这些设置无法在RTB文档中设置,但在您的打印代码中可以设置。



如果您的代码没有进行打印,则必须将其保留在打印的应用程序。这是你的代码在另一个应用程序中无法控制的东西。
There's no such thing in the RichTextBox.

The paper size and orientation are strictly printing concepts that have nothing to do with the RTB itself. The only time this would apply is when your code goes to print the content of the RTB. These settings are not settable in the RTB document, but in your printing code.

If your code isn't doing the printing, that has to be left up to the application that does do the printing. This is something your code has no control over in another application.


所以今天我尝试了这个,这是一个解决方法。富文本框没有设置,但RTF在1.5版中确实有此标记。



RTF文件是多年前创建的标记格式,用于处理7位ASCII和*位mac计算机。



TAGS全部用ASCII编写,因此您可以打开文件并使用您喜欢的解析文件的方法插入您想要的文件设置。

WINDOWS使用Twips 1440到一英寸所以A4向下舍入

宽度8.27 * 1440 = 11,908

高度是11.69 * 1440 = 16,833

我将边距设置为默认边距

我们可以在标签为\ line的任何行上插入它,以便我们查找\ line并插入新标签。在大多数情况下,大多数地方都可以使用。



为了方便起见,我将采用旧时尚的方式,使用FILEOPEN



Dim PageSize As String

'评论一个

'肖像

PageSize =

\ paperw12240\paperh15840\margl1440\margr1440\margt1800\margb1800



'景观

PageSize =\ paperw16834\paperh11909\margl1440\margr1900\margt1800\margb1800\landscape

现在打开文件将它粘贴在一个集合中

Dim LineCol As New StringCollection

Dim InData As String

FileOpen(1,C:\ .FILENAME.rtf,OpenMode.Input)

Do EOF( 1)<>错误

InData = LineInput(1)

LineCol.Add(InData)

循环

FileClose(1)

'没有把数据写回来

FileOpen(1,C:\ FILENAME.rtf,OpenMode.Output)

Dim found as Boolean = vbFalse

Dim Find As Integer

For LineCol中的每个InData

如果找不到则

Find = InStr(InData,\ line,CompareMethod.Text)

如果查找> 0然后

'工作正在这里完成我们发现\ line添加标签

InData = InData.Insert(Find + 5,PageSize)

找到= vbTrue

结束如果

结束如果

打印(1,InData)

下一页

FileClose(1)

我在办公室对此进行了测试并遇到了一些景观问题,但这对我有用

其他标签也可以使用对于风景是\ lndscpsxn

如果你使用字母大小做数学,你可以使用\ ltrsect专门用于写信和

\ltrsect \ lndscpsxn

为景观信件。

这是一个解决方法,但确实有效。

您可以创建自己的类,继承richtextbox并将其添加到其中。
So I tried this today and here is a work around. The rich text box does not have a setting but RTF does have tags for this in version 1.5.

An RTF file is a tagged format created MANY years ago to work with 7 bit ASCII and * bit mac computers.

The TAGS are all written in ASCII so you can open the file and insert the settings that you want to have in the file with your favorite method of parsing files.
WINDOWS uses Twips 1440 to an inch so A4 is rounding down
Width 8.27 * 1440=11,908
Height is 11.69 * 1440= 16,833
I set the margins at default margins
We can insert this on any line the tag is \line so we look for a \line and insert new tags. most anywhere will work in most cases.

To make this easy I will do this the old fashion way, using FILEOPEN

Dim PageSize As String
'Comment out one
'Portrait
PageSize = "
\paperw12240\paperh15840\margl1440\margr1440\margt1800\margb1800 "

'Landscape
PageSize = " \paperw16834\paperh11909\margl1440\margr1900\margt1800\margb1800\landscape "
Now open the file stick it in a collection
Dim LineCol As New StringCollection
Dim InData As String
FileOpen(1, "C:\FILENAME.rtf", OpenMode.Input)
Do Until EOF(1) <> False
InData = LineInput(1)
LineCol.Add(InData)
Loop
FileClose(1)
'NOw write the data back out
FileOpen(1, "C:\FILENAME.rtf", OpenMode.Output)
Dim found As Boolean = vbFalse
Dim Find As Integer
For Each InData In LineCol
If Not found Then
Find = InStr(InData, "\line", CompareMethod.Text)
If Find > 0 Then
'work is getting done here we found a \line adding tags
InData = InData.Insert(Find + 5, PageSize)
found = vbTrue
End If
End If
Print(1, InData)
Next
FileClose(1)
I have tested this at the office and had some issues with landscape but this works for me
the other tag that also works for landscape is \lndscpsxn
If you were using letter size do the math and you can dedicate the paper using \ltrsect for letter and
\ltrsect\lndscpsxn
for landscape letter.
It is a work around but it does work.
You could make your own class, inherit the richtextbox and add this to it.


这篇关于如何设置A4尺寸的richtextbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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