As several patches of VB6 exit, RichTextBox is quietly changing and supports richedit2.0. Therefore, we can set the dylinespacing Member of the structure paraformat2 and use the paraformat2 struct as the lparam parameter, to send the em_setparaformat message to RichTextBox, You can implement our requirements. The specific code is as follows:
Option explicit
Private declare function sendmessage & lib "USER32" alias "sendmessagea "_
(Byval hwnd as long, byval wmsg as long ,_
Byval wparam as long, lparam as any)
Private const wm_user & = & H400
Private const em_getparaformat = (wm_user + 61)
Private const em_setparaformat = (wm_user + 71)
Private const max_tab_stops = 32 &
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? 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
'/* Paraformat mask values */
Private const pfm_startindent = & H1 &
Private const pfm_rightindent = & H2 &
Private const pfm_offset = & H4 &
Private const pfm_alignment = & H8 &
Private const pfm_tabstops = & H10 &
Private const pfm_numbering = & H20 &
Private const pfm_offsetindent = & h80000000
'/* Paraformat Numbering Options */
Private const pfn_bullet = & H1 &
'/* Paraformat alignment options */
Private const pfa_left = & H1 &
Private const pfa_right = & H2 &
Private const pfa_center = & H3 &
'/* Paraformat 2.0 masks */
Private const pfm_spacebefore = & h40 &
Private const pfm_spaceafter = & h80 &
Private const pfm_linespacing = & h100 &
Private const pfm_style = & H400 &
Private const pfm_numberingstyle = & h2000 & '/* re 3.0 */
Private const pfm_numberingtab = & h4000 & '/* re 3.0 */
Private const pfm_numberingstart = & h8000 & '/* re 3.0 */
Private const pfm_table = & hc0000000 '/* re 3.0 */
'// The following three properties are read only
Private const pfm_collapsed = & h000000'/* re 3.0 */
Private const pfm_outlinelevel = & h2000000 '/* re 3.0 */
Private const pfm_box = & h4000000 '/* re 3.0 */
'/* Paraformat2 wnumbering options (see also pfn_bullet )*/
Private const pfn_arabic = 2'/* tomlistnumberasarabic: 0, 1, 2 ,...*/
Private const pfn_lcletter = 3'/* tomlistnumberaslcletter: A, B, C ,...*/
Private const pfn_ucletter = 4'/* tomlistnumberasucletter: A, B, C ,...*/
Private const pfn_lcroman = 5'/* tomlistnumberaslcroman: I, II, III ,...*/
Private const pfn_ucroman = 6'/* tomlistnumberasucroman: I, II, III ,...*/
'/* Paraformat2 wnumberingstyle options */
Private const pfns_paren = & H0 '/* default, e.g., 1 )*/
Private const pfns_parens = & h100 '/* tomlistparentheses/256, e.g., (1 )*/
Private const pfns_period = & h200 '/* tomlistperiod/256, e.g., 1 .*/
Private const pfns_plain = & H300 '/* tomlistplain/256, e.g., 1 */
Private const pfns_nonumber = & H400 '/* used for continuation W/O number
Private sub form_load ()
Dim pf as paraformat2
With pf
. Cbsize = lenb (PF)
PF. dwmask = pfm_linespacing
. Blinespacingrule = 4
. Dylinespacing = 40*15
End
Dim I as long
I = sendmessage (richtextbox1.hwnd, em_setparaformat, 0, byval varptr (PF ))
End sub