how do I centre the text in a TppRichText control at runtime ?
Using Delphi 7 and 10.06 Enterprise
If I want to programmatically populate a TppRichText control at runtime, how
do I centre the text ? By default it starts from the left. At the moment I'm
using the following code:
procedure TMainForm.ApplyFilterText (const sFilterText : string ; theCtrl :
TppReport) ;
var
iCnt : integer ;
rtCtrl : TppRichText ;
begin
if theCtrl.TitleBand.ObjectByName (iCnt, ksReportFilter) then
begin
rtCtrl := theCtrl.TitleBand.Objects [iCnt] as TppRichText ;
rtCtrl.Font.Name := 'Arial' ;
rtCtrl.Font.Size := 9 ;
rtCtrl.RichText := sFilterText ;
end ;
end ;
If I want to programmatically populate a TppRichText control at runtime, how
do I centre the text ? By default it starts from the left. At the moment I'm
using the following code:
procedure TMainForm.ApplyFilterText (const sFilterText : string ; theCtrl :
TppReport) ;
var
iCnt : integer ;
rtCtrl : TppRichText ;
begin
if theCtrl.TitleBand.ObjectByName (iCnt, ksReportFilter) then
begin
rtCtrl := theCtrl.TitleBand.Objects [iCnt] as TppRichText ;
rtCtrl.Font.Name := 'Arial' ;
rtCtrl.Font.Size := 9 ;
rtCtrl.RichText := sFilterText ;
end ;
end ;
This discussion has been closed.
Comments
--
Ed Dressel
Team DM
I checked some earlier posts (I should have done that before I posted mine,
sorry) and have now sorted my problem. Shown below is the function I am
using in hope that it may help others.
procedure TMainForm.ApplyFilterText (const sFilterText : string ; theCtrl :
TppReport) ;
var
iCnt : integer ;
rtCtrl : TppRichText ;
begin
if theCtrl.TitleBand.ObjectByName (iCnt, ksReportFilter) then
begin
rtCtrl := theCtrl.TitleBand.Objects [iCnt] as TppRichText ;
rtCtrl.RichText := sFilterText ;
rtCtrl.SelectAll ;
rtCtrl.SelAttributes.Color := clNavy ;
rtCtrl.SelAttributes.Name := 'Arial' ;
rtCtrl.SelAttributes.Size := 10 ;
rtCtrl.SelAttributes.Style := [fsBold] ;
rtCtrl.Paragraph.Alignment := taCenter ;
end ;
end ;