Make an installer with text that is formatted (Par

2020-06-18 10:10发布

问题:

Anyone saw GOG.com game installer? How to make welcome text string like there including Path and Need Size in a single Caption? Where part of is bolded.

Here are examples of how changes String line breaking after modifying install path

回答1:

You can use a TRichEditViewer setting the RFTText property and the UseRichEdit to True.

Try this sample

procedure CreateCustomPages;
var
  Page                 : TWizardPage;
  rtfHelpText          : TRichEditViewer;
  s: string;
begin
 Page := CreateCustomPage(wpWelcome, 'Custom wizard page controls', 'Bold Demo');
 Page.Surface.Align:=alCLient;

 s:='{\rtf1\ansi\ansicpg1252\deff0\deflang13322{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}'+
    '\viewkind4\uc1\pard\f0\fs16 This is a normal text, \b and this is a bold text\b0\par}';

 rtfHelpText := TRichEditViewer.Create(Page);
 rtfHelpText.Parent := Page.Surface;
 rtfHelpText.Left :=    0;
 rtfHelpText.Top := 0;
 rtfHelpText.Width := Page.SurfaceWidth;
 rtfHelpText.Height := Page.SurfaceHeight;
 rtfHelpText.Scrollbars := ssVertical;
 rtfHelpText.ReadOnly := True;
 rtfHelpText.UseRichEdit := True;
 rtfHelpText.RTFText := s;
end;

procedure InitializeWizard();
begin
  CreateCustomPages();
end;