Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Paintbox-Inhalt in Bilddatei speichern (https://www.delphipraxis.net/32646-paintbox-inhalt-bilddatei-speichern.html)

clarity 26. Okt 2004 16:03


Paintbox-Inhalt in Bilddatei speichern
 
Hi !
Der Titel sagt alles !
Ist das in Delphi möglich, wenn ja wie? HAb schon in der Delphi Hilfe und hier im forum gesucht, aber nichts rechtes gefunden :oops:

Danke schon mal,
MfG Alex

jim_raynor 26. Okt 2004 16:25

Re: Paintbox-Inhalt in Bilddatei speichern
 
Direct ist es nicht möglich. Du kannst aber in ein TBitmap Zeichen.

Delphi-Quellcode:
var
  Bitmap: TBitmap;
begin
  Bitmap:=TBitmap.Create;
  Bitmap.Width:=xxx;
  Bitmap.Height:=xxx;
  // hier kommen jetzt die Zeichen Funktionen und zwar Statt PaintBox.Cancas Bitmap.Canvas
  Bitmap.SaveToFile(xxx);
  Bitmap.Free;
end;

clarity 26. Okt 2004 21:33

Re: Paintbox-Inhalt in Bilddatei speichern
 
DAnke, funzt super !

Spasskeks 29. Mai 2005 20:07

Re: Paintbox-Inhalt in Bilddatei speichern
 
Moin. Hab da nochmal eine Frage zu. Hab den Code genau so übernommen und angeblich ist in dem Bild auch genau das drin, was drin sein soll aber mein photoshop sagt mir, die Datei könnte nicht gelesen werden. Woran könnte das liegen?!?

MFG Henrik

turboPASCAL 29. Mai 2005 21:28

Re: Paintbox-Inhalt in Bilddatei speichern
 
Delphi-Quellcode:
procedure TForm1.Save...
var
  Bitmap: TBitmap;
begin
  Bitmap:=TBitmap.Create;
  Bitmap.PixelFormat := pf32bit; // 16Mio Farben  siehe Hilfe: PixelFormat
  Bitmap.Width:=PaintBox1.Width;
  Bitmap.Height:=PaintBox1.Height;

  // zB. ein Rechteck zeichnen
  paintbox1.Canvas.Pen.Color := clred;
  paintbox1.Canvas.Rectangle(Bounds(0,0,paintbox1.Width, paintbox1.Height));

  // Bild aus PaintBox1 ins Bitmap
  Bitmap.Canvas.CopyRect(Bounds(0,0,bitmap.Width, Bitmap.Height),
    PaintBox1.Canvas, PaintBox1.ClientRect);

  Bitmap.SaveToFile({Path +} 'Bild.bmp');
  Bitmap.Free;
end;
Solle so funktionieren an sonsten... (mal mit Paint Shop Pro öffnen :mrgreen: )


MfG.

He4db4nger 10. Jan 2006 19:07

Re: Paintbox-Inhalt in Bilddatei speichern
 
ich weiß, der Thread hier ist uralt, aber:
klappt das auch auf Knopfdruck?

Muetze1 10. Jan 2006 19:38

Re: Paintbox-Inhalt in Bilddatei speichern
 
Kopier doch einfach mal den Inhalt der Procedure in deine Click Methode deines Buttons und teile uns dann mal bitte mit, ob das so einfach zu übernehmen geht...

He4db4nger 10. Jan 2006 21:24

Re: Paintbox-Inhalt in Bilddatei speichern
 
also bei mir klappts nicht.. ^^

Luckie 10. Jan 2006 21:28

Re: Paintbox-Inhalt in Bilddatei speichern
 
Zitat:

Zitat von He4db4nger
also bei mir klappts nicht.. ^^

Umwerfende Fehlerbeschreibung. :thumb: Und jetzt?

He4db4nger 10. Jan 2006 22:06

Re: Paintbox-Inhalt in Bilddatei speichern
 
ich versteht hier echt viel spaß :evil:

jedenfalls klappts jetzt bei mir, wenn man diese 2 Zeilen unter // ein Rechteck zeichnen weglässt!


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:07 Uhr.
Seite 1 von 2  1 2      

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