Author: Peter Below
How to show bullets in a TRichEdit?
Answer:
1 uses
2 RichEdit;
3
4 procedure TForm1.Button1Click(Sender: TObject);
5 var
6 fmt: TParaformat2;
7 begin
8 FillChar(fmt, SizeOf(fmt), 0);
9 fmt.cbSize := SizeOf(fmt);
10 // The PARAFORMAT2 structure is used to set the numbering style.
11 // This is done through the following structure members:
12 fmt.dwMask := PFM_NUMBERING or PFM_NUMBERINGSTART or PFM_NUMBERINGSTYLE or
13 PFM_NUMBERINGTAB;
14 // Set the following values (bitwise-or them together) to identify
15 // which of the remaining structure members are valid:
16 // PFM_NUMBERING, PFM_NUMBERINGSTART, PFM_NUMBERINGSTYLE, and PFM_NUMBERINGTAB
17 fmt.wNumbering := 2;
18 //0 no numbering or bullets
19 //1 (PFN_BULLET) uses bullet character
20 //2 Uses Arabic numbers (1, 2, 3, ...).
21 //3 Uses lowercase letters (a, b, c, ...).
22 //4 Uses uppercase letters (A, B, C, ...).
23 //5 Uses lowercase Roman numerals (i, ii, iii, ...).
24 //6 Uses uppercase Roman numerals (I, II, III, ...).
25 //7 Uses a sequence of characters beginning with the Unicode
26 // character specified by the wNumberingStart member.
27 fmt.wNumberingStart := 1;
28 // Starting value for numbering.
29 fmt.wNumberingStyle := $200;
30 // Styles for numbering:
31 // 0 : Follows the number with a right parenthesis. 1)
32 // $100 : Encloses the number in parentheses. (1)
33 // $200 : Follows the number with a period. 1.
34 // $300 : Displays only the number. 1
35 // $400 : Continues a numbered list without applying the next number or bullet.
36 // $8000 : Starts a new number with wNumberingStart.
37 fmt.wNumberingTab := 1440 div 4;
38 // Minimum space between a paragraph number and the paragraph text, in twips
39
40 RichEdit1.Perform(EM_SETPARAFORMAT, 0, lParam(@fmt));
41 end;
|