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 Richedit manuell manuell formatieren (https://www.delphipraxis.net/119892-richedit-manuell-manuell-formatieren.html)

Neutral General 2. Sep 2008 22:44


Richedit manuell manuell formatieren
 
Hi,

Ich würde gerne einen String hinzufügen, der rtf-code enthält, der diesen String formatiert. Also sowas:

Delphi-Quellcode:
Richedit1.Lines.Add('{\rtf1\ul Hi \ulnone Neutral General}');
Diesen Thread habe ich schon gesehen, aber der hilft mir nicht weiter.

Das da oben funktioniert generell schon. Allerdings bekomme ich bevor es klappt eine Exception:

Zitat:

---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EOutOfResources with message 'RichEdit line insertion error'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
Und das klappt dann irgendwie auch nur einmal.

Wenn ich das \rtf1 weglasse, escaped er alles brav :?

Kennt da jemand ne Möglichkeit?

Gruß
Neutral General

marabu 3. Sep 2008 07:04

Re: Richedit manuell manuell formatieren
 
Hallo Michael,

Zitat:

Zitat von Neutral General
... Diesen Thread habe ich schon gesehen, aber der hilft mir nicht weiter. ...

manchmal musst du gefundenen Code etwas anpassen:

Delphi-Quellcode:
procedure TDemoForm.AppendButtonClick(Sender: TObject);
begin
  with RichEdit do
  begin
    SelStart := MaxInt;
    SelText := '{\rtf1\ul Hi \ulnone Neutral General}';
    Lines.Add('');
  end;
end;
Freundliche Grüße

Neutral General 3. Sep 2008 07:57

Re: Richedit manuell manuell formatieren
 
Manchmal muss man dadrauf erstmal kommen :mrgreen: Aber danke ;)


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:14 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