1

Как в компоненте RichEdit сделать нумерованный список?

1

2 ответа 2

1

Ну типа так

var
s:String;
i:integer;
Begin
for i:=0 to RichEdit1.Lines.count-1 do 
begin
s:=RichEdit1.lines.Strings[i];
s:=IntToStr(i)+'. '+s;
RichEdit1.lines.Strings[i]:=s;
end;

end;
7
  • нумерованный список, а не нумерацию строк
    – woland
    30 янв 2013 в 16:21
  • ну так проверяй в цикле, и инкременируй номер.
    – Rsecomua
    30 янв 2013 в 16:28
  • нумерованный список это: 1. 2. 3. 4.
    – woland
    30 янв 2013 в 16:31
  • стандартного метода нет, реализуй сам способом который покажется самым удобным
    – Rsecomua
    30 янв 2013 в 16:37
  • есть маркированный, но нет нумерованного? оО
    – woland
    30 янв 2013 в 16:45
1

Перерыв кучу ссылок, я таки нашел ответ, может кому еще понадобится.

Вот цитата из нее:

uses
   RichEdit;

 procedure TForm1.Button1Click(Sender: TObject);
 var
   fmt: TParaformat2;
 begin
   FillChar(fmt, SizeOf(fmt), 0);
   fmt.cbSize := SizeOf(fmt);
   // The PARAFORMAT2 structure is used to set the numbering style. 
  // This is done through the following structure members: 
  fmt.dwMask := PFM_NUMBERING or PFM_NUMBERINGSTART or PFM_NUMBERINGSTYLE or
                 PFM_NUMBERINGTAB;
       // Set the following values (bitwise-or them together) to identify 
      // which of the remaining structure members are valid: 
      // PFM_NUMBERING, PFM_NUMBERINGSTART, PFM_NUMBERINGSTYLE, and PFM_NUMBERINGTAB 
  fmt.wNumbering := 2;
       //0 no numbering or bullets 
      //1 (PFN_BULLET) uses bullet character 
      //2 Uses Arabic numbers (1, 2, 3, ...). 
      //3 Uses lowercase letters (a, b, c, ...). 
      //4 Uses uppercase letters (A, B, C, ...). 
      //5 Uses lowercase Roman numerals (i, ii, iii, ...). 
      //6 Uses uppercase Roman numerals (I, II, III, ...). 
      //7 Uses a sequence of characters beginning with the Unicode 
      //  character specified by the wNumberingStart member. 
  fmt.wNumberingStart := 1;
       //  Starting value for numbering. 
  fmt.wNumberingStyle := $200;
       // Styles for numbering: 
      // 0 : Follows the number with a right parenthesis.  1) 
      // $100 : Encloses the number in parentheses.       (1) 
      // $200 : Follows the number with a period.          1. 
      // $300 : Displays only the number.                  1 
      // $400 : Continues a numbered list without applying the next number or bullet. 
      // $8000 : Starts a new number with wNumberingStart. 
  fmt.wNumberingTab := 1440 div 4;
   // Minimum space between a paragraph number and the paragraph text, in twips 

  RichEdit1.Perform(EM_SETPARAFORMAT, 0, lParam(@fmt));
 end;
0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.