6 Nisan 2010 Salı

Ico to Bmp Convert

procedure TForm1.ConvertIcon2BitmapClick(Sender: TObject);

var
s : string;
Icon: TIcon;
begin

OpenDialog1.DefaultExt := '.ICO';

OpenDialog1.Filter := 'icons (*.ico)|*.ICO';
OpenDialog1.Options := [ofOverwritePrompt, ofFileMustExist, ofHideReadOnly ];
if OpenDialog1.Execute then
begin
Icon := TIcon.Create;
try
Icon.Loadfromfile(OpenDialog1.FileName);
s:= ChangeFileExt(OpenDialog1.FileName,'.BMP');
Image1.Width := Icon.Width;
Image1.Height := Icon.Height;
Image1.Canvas.Draw(0,0,Icon);
Image1.Picture.SaveToFile(s);

ShowMessage(OpenDialog1.FileName + ' Saved to ' + s);
finally
Icon.Free;
end;
end;
end;

Hiç yorum yok:

Yorum Gönder