Autor Beitrag
Comp-Freak
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 89



BeitragVerfasst: Do 03.05.07 10:56 
Ich moechte einen text in der mitte von einem bild ausgeben. Dazu muss ich die groesse des texts in pixeln wissen. So gehts dann (hoff ich):
textout(bildgroese div 2 - text groese div 2,bildgroese div 2 - text groese div 2,text);
also irgendeine idee?
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 03.05.07 11:20 
mit Canvas.Textheight und Canvas.Textwidth kann man höhe und breite von einem als parameterübergebenen text herausfinden.

z.b:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
  iTxtHeight:=Bitmap1.Canvas.Textheight('Mukuh');
  iTxtWidth:=Bitmap1.Canvas.Textwidth('Mukuh');

  Bitmap1.Canvas.Textout((Bitmap1.Width div 2) - (iTxtWidth div 2), (Bitmap1.Height div 2) - (iTxtHeight div 2), 'Mukuh');


gegebenenfalls halt die parameter von textout so vertauschen das es auch richtig funzt!

lg el

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Do 03.05.07 11:21 
Hallo,

und mit Zeilenumbruch:
DrawText mit DT_WORDBREAK or DT_CALCRECT
Ansätze:
www.delphi-forum.de/....php?p=434266#434266
www.delphi-forum.de/....php?p=372572#372572

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )