Solved

how to center only a line in richedit?

Posted on 2016-07-20
4
82 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

724 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