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 Text mit Zeilenumbruch auf Bitmap ausgeben (https://www.delphipraxis.net/10322-text-mit-zeilenumbruch-auf-bitmap-ausgeben.html)

SirThornberry 16. Okt 2003 09:00


Text mit Zeilenumbruch auf Bitmap ausgeben
 
Ich will auf einer Bitmap Text ausgeben, das problem jetzt ist wenn der Text zu lang ist das er nicht umgebrochen wird. Wenn ich in den String den ich dann mit canvas.textout so
'text'#13#10'zeile2'
definiere gibt er mit die sonderzeischen (13 und 10) als Viereck aus also geht auch das nicht. Wie könnte man das machen???

Luckie 16. Okt 2003 09:14

Re: Text mit Zeilenumbruch auf Bitmap ausgeben
 
Von Hand umbrechen oder die API DrawText nehmen mit dem Flag DT_WORDBREAK:
Zitat:

Zitat von PSDK
Breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the lpRect parameter. A carriage return-line feed sequence also breaks the line.
If this is not specified, output is on one line.

kombiniert mit DT_CALCRECT.

Gollum 16. Okt 2003 09:26

Re: Text mit Zeilenumbruch auf Bitmap ausgeben
 
Hallo,

anstatt DT_CALCRECT würde ich DT_WORDBREAK benutzen.

Zitat:

...
DT_CALCRECT
Determines the width and height of the rectangle. If there are multiple lines of text, DrawText uses the width of the rectangle pointed to by the lpRect parameter and extends the base of the rectangle to bound the last line of text. If there is only one line of text, DrawText modifies the right side of the rectangle so that it bounds the last character in the line. In either case, DrawText returns the height of the formatted text but does not draw the text.
...
DT_WORDBREAK
Breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the lpRect parameter. A carriage return-linefeed sequence also breaks the line.
...

Luckie 16. Okt 2003 09:35

Re: Text mit Zeilenumbruch auf Bitmap ausgeben
 
Les mal genau, was ich geschrieben habe. Eventuell muß man es kombinieren.

Gollum 16. Okt 2003 10:10

Re: Text mit Zeilenumbruch auf Bitmap ausgeben
 
Hallo,

wer lesen kann, ist klar im Vorteil :wall:

DT_CALCRECT wird im Zusammenhang mit DT_WORDBREAK prinzipiell nicht benötigt. Interessant wird es nur, wenn ich meine Ausgabehöhe (z.B. eine Zelle in einem Grid) vergrößern muss, um sicherzustellen, dass der Text auch komplett angezeigt wird.


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