Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Formatierbares Eingebefeld (https://www.delphipraxis.net/57579-formatierbares-eingebefeld.html)

3_of_8 23. Nov 2005 14:49


Formatierbares Eingebefeld
 
Hallo! Ich suche eine Art TRichEdit, die man leicht formatieren kann, am besten so wie in HTML oder BB-Code, also praktisch: asdffdsaasdf => asdffdsaasdf

robinWie 23. Nov 2005 16:18

Re: Formatierbares Eingebefeld
 
Probier mal RichEdit1.Paragraph

marabu 23. Nov 2005 17:34

Re: Formatierbares Eingebefeld
 
Hi Manuel,

vielleicht ist hier etwas für dich dabei: klick

Grüße vom marabu

3_of_8 23. Nov 2005 17:48

Re: Formatierbares Eingebefeld
 
@robinWie: Hilft mir nicht weiter, leider.

@marabu: Danke. Ich habe gefunden, was ich brauchte, aber ich verstehe es noch nicht ganz. Was bedeutet was im einzelnen?

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var MyMS: TMemoryStream;
    MyRTFList : TStringList;
    s1, s2 ,s3 ,s4 : String;
begin
  s1 := 'Fett und grün';
  s2 := 'Kursiv und schwarz';
  s3 := 'Normal und blau';
  s4 := 'Fett und magneta';
  MyRTFList := TStringList.Create;
  MyMS := TMemoryStream.Create;
  try
    MyRTFList.Add('{\rtf1{\fonttbl{\f0 Arial;\f1 Courier;}}');
    MyRTFList.Add('{\colortbl;\red0\green128\blue0;\red0\green0\blue0;\red0\green0\blue255;\red255\green0\blue255;\red255\green0\blue0;}');
    MyRTFList.Add('\pard\plain\fs24');
    MyRTFList.Add('\cf1\b '+s1+'\b0\par');
    MyRTFList.Add('\cf2\i '+s2+'\i0\par');
    MyRTFList.Add('\cf3 '+s3+'\par');
    MyRTFList.Add('\cf4\b '+s4+'\b0\par');
    MyRTFList.Add('\cf2\ul Unterstrich\ul0\par');
    MyRTFList.Add('\f1\fs16 kleine Schrift\par\tab in Courier 8}');
    MyRtfList.SaveToStream(MyMS);
    MyMS.Seek(soFromBeginning,0);
    RichEdit1.PlainText := False;
    RichEdit1.Lines.LoadFromStream(MyMS);
  finally
    MyRTFList.Free;
    MyMS.Free;
  end;
end;

marabu 23. Nov 2005 18:15

Re: Formatierbares Eingebefeld
 
Du siehst da im wesentlichen RTF command words. Beschrieben sind die in der RTF Spezifikation von Microsoft. Die RichEdit-Komponente kann mit Text oder mit RTF beschickt werden, je nach Einstellung von PlainText. Da in diesem Code mit den direkten commands nicht über die in der Komponente gekapselte Funktionalität hinaus gegangen wird, halte ich das aber mehr für eine Spielerei.

marabu


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:44 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz