Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#5

Re: verhindern das bereits vorhandenes bild überschrieben wi

  Alt 15. Sep 2008, 00:18
Hi,

Du musst/kannst das neue Bild in ein temporäres Bitmap laden und dann auf das Bitmap im Image malen:

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var tmp: TBitmap;
begin
  if Opendialog1.Execute then
  begin
    if Image1.Picture.Bitmap.Empty then
      Image1.Picture.Bitmap.LoadFromFile(Opendialog1.FileName)
    else
    begin
      tmp := TBitmap.Create;
      try
        tmp.LoadFromFile(Opendialog1.FileName);
        Image1.Picture.Bitmap.Canvas.Draw(0,0,tmp);
      finally
        tmp.Free;
      end;
    end;
  end;
end;
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat