Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TRTFLabel
Using the design-time editor at runtime

To use the TRTFLabel design-time editor at runtime, add the unit FRTFBox to the uses list and add following code:
var
  rtfbox: TRTFBox;
  ms: TStringStream;
begin
  rtfbox := TRTFBox.Create(Self);
  ms := TStringStream.Create;
  try
    ms.WriteString(rtflabel1.RichText);
    ms.Position := 0;
    rtfbox.RTFControl.Lines.LoadFromStream(ms);
    if rtfbox.ShowModal = mrOK then
    begin
      ms.Clear;
      rtfbox.RTFControl.Lines.SaveToStream(ms);
      rtflabel1.RichText := ms.DataString;
    end;
  finally
    ms.Free;
    rtfbox.Free;
  end;
end;