Solved

how to center only a line in richedit?

Posted on 2016-07-20
4
44 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
thanks
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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 video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

10 Experts available now in Live!

Get 1:1 Help Now