procedure TForm1.Button1Click(Sender: TObject); var bmp: TBitmap; begin if Image1.Picture.Graphic is TJPEGImage then begin bmp := TBitmap.Create; bmp.Assign(Image1.Picture.Graphic); Image1.Picture.Assign(bmp); // 测试Image1是否为bmp格式 */ if Image1.Picture.Graphic is TBitmap then ShowMessage('Bitmap'); bmp.Free; end; end;
procedure TForm1.Button1Click(Sender: TObject);
var
bmp: TBitmap;
begin
if Image1.Picture.Graphic is TJPEGImage then
begin
bmp := TBitmap.Create;
bmp.Assign(Image1.Picture.Graphic);
Image1.Picture.Assign(bmp);
// 测试Image1是否为bmp格式 */
if Image1.Picture.Graphic is TBitmap then
ShowMessage('Bitmap');
bmp.Free;
end;
end;