delphidelphi-7richedittrichedit

TRichEdit - How to add an empty line with size change?


I have array of strings and i want to add an empty line of lesser size between some of them. So i have a code:

  const _n=#13#10;
  //...
  r1.Lines.Clear;
  r1.SelAttributes.Size:=18;
  r1.SelText:='TEST';
  r1.SelAttributes.Size:=6;
  r1.SelText:=_n+'............';
  r1.SelAttributes.Size:=18;
  r1.SelText:=_n+'test1';
  r1.SelAttributes.Size:=6;
  r1.SelText:=_n+' ';
  r1.SelAttributes.Size:=18;
  r1.SelText:=_n+'test2';

and size change works for first line (with dots), but line between test1 and test2 has same size as they (18) somehow =\

Any suggestions?


Solution

  • I found some workaround: it's possible to use tab-symbol in place of space.

    So the following code works fine:

      r1.SelAttributes.Size:=18;
      r1.SelText:=_n+'test1';
      r1.SelAttributes.Size:=6;
      r1.SelText:=_n+#9; // <- tab here
      r1.SelAttributes.Size:=18;
      r1.SelText:=_n+'test2';