Autor Beitrag
colaka
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 200
Erhaltene Danke: 4

Win XP, W7
Delphi 2005 Prof.
BeitragVerfasst: Mo 31.12.07 19:53 
Hallo,

ich möchte die Bilddatei aus einem OpenPicturedialog einem TBitmap zuweisen und habe das so probiert:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.Button2Click(Sender: TObject);
var
  Bild : TBitmap;
begin
  with OpenPictureDialog do begin
    if Execute then begin
      Bild.Create;
      Bild.Width := 600;
      Bild.Height := 600;
      Bild.LoadFromFile(OpenPictureDialog.FileName);
    end;
  end;
end;

Der OpenPictureDialog läßt sich noch öffnen, doch beim Schließen erscheint die Fehlermeldung: Zugriffsverletzung an Adresse usw.

Es ist egal, ob ich ein *.bmp oder ein *.jpg laden will. Was mache ich denn da faslch?

Gruß Ebi

Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Mo 31.12.07 20:04 
Hi,

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Button1Click(Sender: TObject);
var
Bild : TBitmap;
begin
with OpenPictureDialog1 do begin
if Execute then begin
  Bild := TBitmap.Create;
  Bild.Width := 600;
  Bild.Height := 600;
  Bild.LoadFromFile(OpenPictureDialog1.FileName);
end;
end;


user defined image

[edit]
...und nicht vergessen bild.free irgendwo einzufügen...
user defined image
PS.: user defined image
user defined image
[/edit]

Gruß

Calculon
--

_________________
Hallo Mutti