Autor Beitrag
huhn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 272
Erhaltene Danke: 1

WIN XP
D7Pers
BeitragVerfasst: Fr 05.11.04 22:19 
Hi leute hab ein prob!immer wenn ich im prog ein bitmap öffnen will kommt ne dumme fehler meldung,ich hab schon einiges probiert aber es will mir nicht gelingen bitmaps zu öffnen(kann nur jpg öffnen).
hier ist mein ausgangscode:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.ffnen1Click(Sender: TObject);
var    jpeg: TJPEGimage;
begin
  openDialog1.DefaultExt := '.jpg,.bmp';
  OpenDialog1.Filter := 'Jpeg oder Bitmap (*.jpg,*.bmp)|*.jpg;*.bmp';
  OpenDialog1.Options := [ofOverwritePrompt, ofFileMustExist, ofHideReadOnly ];
  jpeg:= TJPEGimage.create;
  if opendialog1.Execute then
        try
           Image1.picture.LoadFromFile(OpenDialog1.FileName);
        finally
        jpeg.free
  end;
end;

Was muss ich noch machen das er beides öffnet? :cry: help me!


Moderiert von user profile iconTino: Topic aus Sonstiges verschoben am Mo 08.11.2004 um 12:57
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Sa 06.11.04 09:46 
Hallo

wozu das jpeg:= TJPEGimage.create;? wird doch bei dir nirgends verwendet.

Zitat:

ne dumme fehler meldung

stimmt, ne dumme fehlermeldung, da gibt es ja bloß eine :roll:

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
huhn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 272
Erhaltene Danke: 1

WIN XP
D7Pers
BeitragVerfasst: Sa 06.11.04 09:54 
Ja ok des kann ich wirklich weglassen ändert aber nix
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
---------------------------
Benachrichtigung über Debugger-Exception
---------------------------
Im Projekt Project1.exe ist eine Exception der Klasse EInvalidGraphic aufgetreten. Meldung: 'Bitmap ist ungültig'. Prozess wurde angehalten. Mit Einzelne Anweisung oder Start fortsetzen.
---------------------------
OK   Hilfe   
---------------------------

beim versuch eine bmp zuöffnen kommmt diese fehlermeldung,ich weiß einfach nicht was der will :cry: :?:
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Sa 06.11.04 09:57 
ist dies bei allen Bitmaps so? Was passiert, wenn du diese Bitmaps im z.b. Paint öffnest und sind es wirklich bitmaps (nicht bloß umbenannte jpgs)?

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
huhn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 272
Erhaltene Danke: 1

WIN XP
D7Pers
BeitragVerfasst: Sa 06.11.04 10:59 
Jo habs gerade herausgefunden,sind umbenannte jpgs (bin ich doof!)
hab aber dann das problem das er jpg nich als bmp speichert,was muss ich den hier noch ergänzen?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
begin
  saveDialog1.DefaultExt := '.jpg';
  saveDialog1.Filter := 'Jpeg (*.jpg)|*.jpg';
  if savedialog1.Execute then
    begin
      if FileExists(SaveDialog1.FileName+'.jpg') then
          begin
                if messagedlg('Vorhandene Datei überschreiben?',mtwarning, [mbyes,mbno],7) = mryes
                then image1.picture.bitmap.savetofile(SaveDialog1.FileName+'.bmp');
          end
      else
        begin
          image1.picture.bitmap.savetofile(savedialog1.FileName+'.jpg');
        end;
    end;
end;

bei dem code speichert der geöffnete jpg als bitmap(aber nur endung)
hab schon ein paar versuche gemachtdes zu ändern, aber der macht nicht was ich will!
MfG Chicken