• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 126
  • Last Modified:

how to center only a line in richedit?

Hello guys,

I'd like to center a line of my richEdit, not all text.

I don't know if there is a function where I could pass the line that must be affect with alignment, something like:

(richedit, line, typeAlign)  

I hope someone can help me on this

thanks

Alexandre
0
hidrau
Asked:
hidrau
  • 2
1 Solution
 
lopemCommented:
It seems is not possible (or easy) to center a line in a richedit component. I guess you need a third party component, as http://www.trichview.com

regards,

Lopem


ps. i will search a little more...
0
 
lopemCommented:
I did a little more research. There is a way to align a paragraph i in a Richedit;

To left justify (a paragraph):

 RichEdit.Paragraph.Alignment := taLeftJustify;


To center (a paragraph);

 RichEdit.Paragraph.Alignment := taCenter;

To right justify:

 RichEdit.Paragraph.Alignment := taRightJustify;

regards
Lopem
1
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
In addiction there's a good example on Embarcadero Rad Studio VCL Reference

Look at the example

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;

Open in new window

1
 
hidrauAuthor Commented:
thanks
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now