Option ExplicitPrivate Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongConst WM_USER = &H400 Const PFM_LINESPACING = &H100 Const MAX_TAB_STOPS = 32 Const EM_SETPARAFORMAT = WM_USER + 71Private Type PARAFORMAT2 cbSize As Integer wPad1 As Integer dwMask As Long wNumbering As Integer wReserved As Integer dxStartIndent As Long dxRightIndent As Long dxOffset As Long wAlignment As Integer cTabCount As Integer lTabStops(0 To MAX_TAB_STOPS - 1) As Long 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) */ bCRC As Byte ' /* Reserved for CRC for rapid searching * wShadingWeight As Integer ' /* Shading in hundredths of a per cent wShadingStyle As Integer ' /* Nibble 0: style, 1: cfpat, 2: cbpat wNumberingStart As Integer ' /* Starting value for numbering wNumberingStyle As Integer ' /* Alignment, roman/arabic, (), ), ., wNumberingTab As Integer ' /* Space bet 1st indent and 1st-line wBorderSpace As Integer ' /* Space between border and text wBorderWidth As Integer ' /* Border pen width (twips) wBorders As Integer ' /* Byte 0: bits specify which borders End TypePrivate Sub Command1_Click() Dim x As PARAFORMAT2
Const PFM_LINESPACING = &H100
Const MAX_TAB_STOPS = 32
Const EM_SETPARAFORMAT = WM_USER + 71Private Type PARAFORMAT2
cbSize As Integer
wPad1 As Integer
dwMask As Long
wNumbering As Integer
wReserved As Integer
dxStartIndent As Long
dxRightIndent As Long
dxOffset As Long
wAlignment As Integer
cTabCount As Integer
lTabStops(0 To MAX_TAB_STOPS - 1) As Long
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) */
bCRC As Byte ' /* Reserved for CRC for rapid searching *
wShadingWeight As Integer ' /* Shading in hundredths of a per cent
wShadingStyle As Integer ' /* Nibble 0: style, 1: cfpat, 2: cbpat
wNumberingStart As Integer ' /* Starting value for numbering
wNumberingStyle As Integer ' /* Alignment, roman/arabic, (), ), .,
wNumberingTab As Integer ' /* Space bet 1st indent and 1st-line
wBorderSpace As Integer ' /* Space between border and text
wBorderWidth As Integer ' /* Border pen width (twips)
wBorders As Integer ' /* Byte 0: bits specify which borders
End TypePrivate Sub Command1_Click()
Dim x As PARAFORMAT2
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = Len(RichTextBox1.Text)
x.cbSize = Len(x)
x.dwMask = PFM_LINESPACING
x.bLineSpacingRule = 5
x.dyLineSpacing = 60
Call SendMessage(RichTextBox1.hwnd, EM_SETPARAFORMAT, 0, x)
End SubPrivate Sub Form_Load()
RichTextBox1.Text = RichTextBox1.Text + vbCrLf
RichTextBox1.Text = RichTextBox1.Text + "AAAAAAAAAAAAAAAA"
RichTextBox1.Text = RichTextBox1.Text + vbCrLf
RichTextBox1.Text = RichTextBox1.Text + "BBBBBBBBBBBBBBBBBb"
RichTextBox1.Text = RichTextBox1.Text + vbCrLf
RichTextBox1.Text = RichTextBox1.Text + "CCCCCCCCCCCCCCCCCCcc"
End Sub