![]() |
Re: Text Mittig auf ein bild zeichnen
Willst Du direkt auf das Image oder auf die enthaltene Bitmap zeichnen?
|
Re: Text Mittig auf ein bild zeichnen
auf das bitmap ^^ also nicht die datei sondern das was ich sehe wieso?
|
Re: Text Mittig auf ein bild zeichnen
Delphi-Quellcode:
So besser?
DrawText(image1.Picture.Bitmap.Canvas.Handle,Pchar(edit1.text),length(edit1.Text),r,DT_CENTER );
|
Re: Text Mittig auf ein bild zeichnen
Genau das selbe problem und dabei auch:
Delphi-Quellcode:
und string habe icha cuhs chon direkt eingetragen ist das selbe...
TextOut(round( (image1.picture.Width/2)-(TextWidth(edit1.Text)/2) ),1,edit1.Text);
|
Re: Text Mittig auf ein bild zeichnen
Dann noch anders:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var r:trect; begin image1.Picture:=image2.Picture; r:=Rect(0,0,image1.Width,image1.Height); with Image1.Picture.Bitmap.Canvas do begin Font.Color := clBlack; Brush.Style := bsclear; Font.Size := 10; Font.Name := JvFontComboBox1.FontName; Font.Style := [fsBold]; DrawText(image1.Canvas.Handle, Pchar(trim(edit1.text)), -1, r, DT_CENTER or DT_VCENTER or DT_SINGLELINE); end; image1.Refresh; end; |
Re: Text Mittig auf ein bild zeichnen
jetzt zeichnet er nichts mehr
|
Re: Text Mittig auf ein bild zeichnen
so habe das problem gelößt mit der länge -1 klappt alles O.o...
|
Re: Text Mittig auf ein bild zeichnen
Probiere es mal so:
Delphi-Quellcode:
Canvas.Textwidth gibt die die Textlänge in Pixel in Abhängigkeit von der verwendeten Schrift aus.
var
w: Integer; begin {...} w := Canvas.TextWidth('Testtext'); Canvas.TextOut((Width - w) div 2, 100 {Y-Coord}, 'Testtext'); {...} end; EDIT: Arr ... 2. Seite übersehen. Is aber dennoch einfacher die Lösung ^^ |
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:08 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz