这样试一下
Private Sub Form_Load()
Dim pf As PARAFORMAT2
With pf
.cbSize = LenB(pf)
pf.dwMask = PFM_LINESPACING
.bLineSpacingRule = 4
.dyLineSpacing = 40 * 15
End With
Dim i As Long
i = SendMessage(RichTextBox1.hwnd, EM_SETPARAFORMAT, 0, ByVal VarPtr(pf))
OffsetRichText RichTextBox1, 0, Len(RichTextBox1.Text), 5
End Sub
Private Sub OffsetRichText(box As RichTextBox, start As Integer, length As Integer, offset As Integer)
box.SelStart = start
box.SelLength = length
box.SelCharOffset = ScaleY(offset, vbPoints, vbTwips)
box.SelStart = 0
box.SelLength = 0
End Sub
Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any)
Private Type PARAFORMAT2
'Los primeros campos coinciden con PARAFORMAT y se usan igual
cbSize As Integer
wPad1 As Integer
dwMask As Long
wNumbering As Integer
wEffects As Integer 'No usado en PARAFORMAT
dxStartIndent As Long
dxRightIndent As Long
dxOffset As Long
wAlignment As Integer
cTabCount As Integer
lTabStops(0 To MAX_TAB_STOPS - 1) As Long
' Desde aquí lo a?adido por PARAFORMAT2
dySpaceBefore As Long '/* Vertical spacing before para */
dySpaceAfter As Long '/* Vertical spacing after para */
dyLineSpacing As Long '/* Line spacing depending on Rule */
sStyle As Integer ' /* Style handle */
bLineSpacingRule As Byte '/* Rule for line spacing (see tom.doc) */
bOutlineLevel As Byte '/* Outline Level*/'antes bCRC As Byte
wShadingWeight As Integer '/* Shading in hundredths of a per cent */
wShadingStyle As Integer '/* Byte 0: style, nib 2: cfpat, 3: cbpat*/
wNumberingStart As Integer '/* Starting value for numbering */
wNumberingStyle As Integer ' /* Alignment, Roman/Arabic, (), ), ., etc.*/
wNumberingTab As Integer '/* Space bet 1st indent and 1st-line text*/
wBorderSpace As Integer ' /* Border-text spaces (nbl/bdr in pts) */
wBorderWidth As Integer '/* Pen widths (nbl/bdr in half twips) */
wBorders As Integer '/* Border styles (nibble/border) */
End Type
Private Sub Form_Load()
Dim pf As PARAFORMAT2
With pf
.cbSize = LenB(pf)
pf.dwMask = PFM_LINESPACING
.bLineSpacingRule = 4
.dyLineSpacing = 40 * 15
End With
Dim i As Long
i = SendMessage(RichTextBox1.hwnd, EM_SETPARAFORMAT, 0, ByVal VarPtr(pf))
End Sub