RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomRichEdit.Paragraph Property

Specifies the formatting information for the current paragraphs.

Pascal
property Paragraph: TParaAttributes;
C++
__property TParaAttributes Paragraph;

Read Paragraph to get the TParaAttributes object used by the rich edit control to specify paragraph formatting information. Use the TParaAttributes object to read or write the paragraph formatting information for the current paragraphs. Paragraph formatting information includes alignment, indentation, numbering, and tabs. 

Paragraph is a read-only property, because a TCustomRichEdit object has only one TParaAttributes object, which cannot be changed. The attributes of the current paragraphs, however, can be changed, by setting the properties of the TParaAttributes object.  

The current paragraphs are the paragraphs that contain the selected text. If no text is selected, the current paragraph is the one containing the cursor.

Note: Paragraph is available only at runtime.
 

C++ Examples: 

 

/*
This example requires only a form.  A Rich Edit control is
created on the form and aligned to take the entire client
area of the form.  A series of lines are written to the Rich
Edit control's Lines property, and the Paragraph property
manipulated such that the first items displayed are bulleted,
a second group of lines are unbulleted and centered, and the
last group is left justified and indented.
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  TRichEdit *pRich = new TRichEdit(this);
  pRich->Parent = this;
  pRich->Align = alClient;
  pRich->Lines->Clear();
  // set numbering style
  pRich->Paragraph->Numbering = nsBullet;
  pRich->Lines->Add("Introduction");
  pRich->Lines->Add("New members to our team");
  pRich->Lines->Add("New Budget discussion");
  pRich->Lines->Add("Facilities");
  pRich->Lines->Add("Q & A");
  pRich->Paragraph->Numbering = nsNone;
  pRich->Paragraph->Alignment = taCenter;
  pRich->Lines->Add("");
  pRich->Lines->Add("Suggested Topics: ");
  pRich->Lines->Add("");
  pRich->Paragraph->Alignment = taLeftJustify;
  pRich->Paragraph->FirstIndent = 10;
  pRich->Lines->Add("");
  pRich->Lines->Add("Parking lot repair");
  pRich->Lines->Add("Cost overruns");
}

 

Delphi Examples: 

{
This example requires only a form.  A Rich Edit control is
created on the form and aligned to take the entire client
area of the form.  A series of lines are written to the Rich
Edit control's Lines property, and the Paragraph property
manipulated such that the first items displayed are bulleted,
a second group of lines are unbulleted and centered, and the
last group is left justified and indented.
}
uses ComCtrls;

procedure TForm1.FormCreate(Sender: TObject);
begin
  with TRichEdit.Create(Self) do
  begin
    Parent := Self;
    Align := alClient;
    Lines.Clear;
    // set numbering style
    Paragraph.Numbering := nsBullet;
    Lines.Add('Introduction');
    Lines.Add('New members to our team');
    Lines.Add('New Budget discussion');
    Lines.Add('Facilities');
    Lines.Add('Q & A');
    Paragraph.Numbering := nsNone;
    Paragraph.Alignment := taCenter;
    Lines.Add('');
    Lines.Add('Suggested Topics:');
    Lines.Add('');
    Paragraph.Alignment := taLeftJustify;
    Paragraph.FirstIndent := 10;
    Lines.Add('');
    Lines.Add('Parking lot repair');
    Lines.Add('Cost overruns');
  end;
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!