Einzelnen Beitrag anzeigen

Blackheart

Registriert seit: 4. Mai 2005
846 Beiträge
 
Delphi 7 Enterprise
 
#5

Re: Image exportieren in mehreren Typen

  Alt 1. Jul 2008, 22:45
Delphi-Quellcode:
unit FilterSaveAs;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, jpeg;

type
  TForm1 = class(TForm)
    Button1: TButton;
    SaveDialog1: TSaveDialog;
    Image1: TImage;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  if savedialog1.Execute then
    begin
If SaveDialog1.FilterIndex = 1 Then SaveDialog1.Filename := 'test.jpeg';
If SaveDialog1.FilterIndex = 2 Then SaveDialog1.Filename := 'test.jpg';
If SaveDialog1.FilterIndex = 3 Then SaveDialog1.Filename := 'test.bmp';
If SaveDialog1.FilterIndex = 4 Then SaveDialog1.Filename := 'test.gif';
If SaveDialog1.FilterIndex = 5 Then SaveDialog1.Filename := 'test.tiff';
//saveDialog1.DefaultExt := '.jpg,.bmp'; // macht nicht !
image1.picture.savetofile(savedialog1.FileName+'.bmp');
      end;
end;

end.
Programmieren ist glaub ich nicht dein Ding, such dir ein anderes Hobby.
Blackheart