Solved

how to center only a line in richedit?

Posted on 2016-07-20
4
51 Views
Last Modified: 2016-08-09
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
Comment
Question by:hidrau
  • 2
4 Comments
 
LVL 3

Expert Comment

by:lopem
ID: 41721938
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
 
LVL 3

Expert Comment

by:lopem
ID: 41721954
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
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 500 total points
ID: 41722817
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
 
LVL 1

Author Closing Comment

by:hidrau
ID: 41749713
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

937 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now